jsp编写登录界面
https://www.360docs.net/doc/311813575.html,/blog/20091213/77.html
按以下要求建立用户帐号信息表:
用户ID:字符型,最大长度20
用户姓名:字符型,最大长度20
用户密码:字符型,最大长度20
编写用户登陆页面。当用户输入正确的用户ID及密码后迁移到“登录成功”提示页面。否则用户重新进行登录。
11111 张三111111
22222 李四222222
33333 张五333333
编写这个project时主要遇到了一个jsp页面的url传值问题,其次就是一些逻辑处理的问题
url传参的String n = request.getParameter(“wrongid”);
if(n == “wrongid1″)判断不了。请教了某个高手后才知道java的字符串是不能这样判断的,要用
n.equals()方法。
java中字符串的存储方法不一样,不是基本数据类型。
至此三个实验全部完成了,发现java还是挺有意思的,我很想学java啊……..可惜最近忙的要死,都抽不出时间看书。
我这人最大的杯具就是对什么都感兴趣,什么都懂一点,但是什么都不精通……..
附上核心代码和工程压缩包下载:
index.jsp
login.jsp
String userid = request.getParameter("username");
String password = request.getParameter("password");
if( userid ==""|| userid ==null|| userid.length()>20|| password =="" || password ==null|| password.length()>20)
{
try
{
response.sendRedirect("wrong.jsp?wrongid=1");
}catch(Exception e )
{
}
}
else{
Connection conn =null;
Statement stmt =null;
ResultSet rs =null;
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn
=DriverManager.getConnection("jdbc:mysql://localhost:3306/member?user=root& ;password=root&useUnicode=true&characterEncoding=utf-8");
stmt = conn.createStatement();
String sql="SELECT name FROM member where id="+userid+" and pw="+password;
if(stmt.execute(sql)){
rs = stmt.getResultSet();
while(rs.next()){
out.println("登陆成功!
");
out.println("欢迎您:"+rs.getString("name"));
}
}
conn.close();
}
catch(SQLException ex){
response.sendRedirect("wrong.jsp?wrongid=2");
}catch(InstantiationException e){
response.sendRedirect("wrong.jsp?wrongid=2");
}catch(IllegalAccessException e){
response.sendRedirect("wrong.jsp?wrongid=2");
}catch(ClassNotFoundException e){
response.sendRedirect("wrong.jsp?wrongid=2");
}
finally{
if(rs !=null){
try{
rs.close();
}catch(SQLException sqlEx){}// ignore
rs =null;
}
if(stmt !=null){
try{
stmt.close();
}catch(SQLException sqlEx){}// ignore
stmt =null;
}
}
}
wrong.jsp
String n = request.getParameter("wrongid");
if(n.equals("1")){
out.println("1.您没输入ID或密码。
2.ID和密码不能超过20字符
");
out.println("点此重新登陆");
}
else if(n.equals("2")){
out.println("Sorry,登陆失败。
");
out.println("您输入的用户ID或密码不对哦。
");
out.println("点此重新登陆");
}
else{
out.println("你又在干坏事拉!");
}
工程压缩包下载:
http://cid-87b2103a38e6466e.skydrive.li声明:作者原创,版权所有。未经授权,不得转载
在jsp中用bean和servlet联合实现用户注册、登录
作者:imagebear
版权:imagebear
本例需要的软件和运行环境:
1、Windows2000 Server操作系统
2、jdk1.4
3、JCreator2.5(java源码编辑调试器,吐血推荐!)
4、Macromedia JRun MX
5、Macromedia Dreamweaver MX(非必需)
6、MySQL数据库(最好安装MySQL Control Center)
一、数据库设计
用MySQL Control Center打开MySQL数据库,新建数据库shopping,在其下新建表tbl_user,其中各字段设置如下:
二、编写连接数据库bean:DBConn.java
//DBConn.java
//include required classes
import java.sql.*;
//========================================== // Define Class DBConn
//========================================== public class DBConn
{
public String sql_driver = "org.gjt.mm.mysql.Driver";
public String sql_url = "jdbc:mysql://localhost:3306";
public String sql_DBName = "shopping";
public String user = "sa";
public String pwd = "";
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
public boolean setDriver(String drv)
{
this.sql_driver = drv;
return true;
}
public String getDriver()
{
return this.sql_driver;
}
public boolean setUrl(String url)
{
this.sql_url = url;
return true;
}
public boolean setDBName(String dbname)
{
this.sql_DBName = dbname;
return true;
}
public String getDBName()
{
return this.sql_DBName;
}
public boolean setUser(String user)
{
https://www.360docs.net/doc/311813575.html,er = user;
return true;
}
public String getUser()
{
return https://www.360docs.net/doc/311813575.html,er;
}
public boolean setPwd(String pwd)
{
this.pwd = pwd;
return true;
}
public String getPwd()
{
return this.pwd;
}
public DBConn()
{
try{
Class.forName(sql_driver);//加载数据库驱动程序
this.conn = DriverManager.getConnection(sql_url + "/" + sql_DBName + "?user=" + user + "&password=" + pwd + "&useUnicode=true&characterEncoding=gb2312");
this.stmt = this.conn.createStatement();
}catch(Exception e){
System.out.println(e.toString());
}
}
//执行查询操作
public ResultSet executeQuery(String strSql) {
try{
this.rs = stmt.executeQuery(strSql);
return this.rs;
}catch(SQLException e){
System.out.println(e.toString());
return null;
}catch(NullPointerException e){
System.out.println(e.toString());
return null;
}
}
//执行数据的插入、删除、修改操作 public boolean execute(String strSql)
{
try{
if(this.stmt.executeUpdate(strSql) == 0)
return false;
else
return true;
}catch(SQLException e){
System.out.println(e.toString());
return false;
}catch(NullPointerException e){
System.out.println(e.toString());
return false;
}
}
//结果集指针跳转到某一行
public boolean rs_absolute(int row)
{
try{
this.rs.absolute(row);
return true;
}catch(SQLException e){ System.out.println(e.toString()); return false;
}
}
public void rs_afterLast()
{
try{
this.rs.afterLast();
}catch(SQLException e){ System.out.println(e.toString()); }
}
public void rs_beforeFirst()
{
try{
this.rs.beforeFirst();
}catch(SQLException e){ System.out.print(e.toString()); }
}
public void rs_close()
{
try{
this.rs.close();
}catch(SQLException e){ System.out.print(e.toString()); }
}
public void rs_deleteRow()
{
try{
this.rs.deleteRow();
}catch(SQLException e){
System.out.print(e.toString());
}
}
public boolean rs_first()
{
try{
this.rs.first();
return true;
}catch(SQLException e){
System.out.print(e.toString());
return false;
}
}
public String rs_getString(String column)
{
try{
return this.rs.getString(column);
}catch(SQLException e){
System.out.println(e.toString());
return null;
}
}
//此方法用于获取大段文本,
//将其中的回车换行替换为
//输出到html页面
public String rs_getHtmlString(String column) {
try{
String str1 = this.rs.getString(column);
String str2 = "¥r¥n";
String str3 = "
";
return this.replaceAll(str1,str2,str3);
}catch(SQLException e){
System.out.println(e.toString());
return null;
}
}
//把str1字符串中的str2字符串替换为str3字符串
private static String replaceAll(String str1,String str2,String str3)
{
StringBuffer strBuf = new StringBuffer(str1);
int index=0;
while(str1.indexOf(str2,index)!=-1)
{
index=str1.indexOf(str2,index);
strBuf.replace(str1.indexOf(str2,index),str1.indexOf(str2,index)+str2.length(),str3); index=index+str3.length();
str1=strBuf.toString();
}
return strBuf.toString();
}
public int rs_getInt(String column)
{
try{
return this.rs.getInt(column);
}catch(SQLException e){
System.out.println(e.toString());
return -1;
}
}
public int rs_getInt(int column)
{
try{
return this.rs.getInt(column);
}catch(SQLException e){ System.out.println(e.toString()); return -1;
}
}
public boolean rs_next()
{
try{
return this.rs.next();
}catch(SQLException e){ System.out.println(e.toString()); return false;
}
}
//判断结果集中是否有数据 public boolean hasData()
{
try{
boolean has_Data = this.rs.first(); this.rs.beforeFirst();
return has_Data;
}catch(SQLException e){ System.out.println(e.toString()); return false;
}
}
public boolean rs_last()
{
try{
return https://www.360docs.net/doc/311813575.html,st();
}catch(SQLException e){ System.out.println(e.toString());
return false;
}
}
public boolean rs_previous()
{
try{
return this.rs.previous();
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
//main方法,调试用
public static void main(String args[])
{
try{
DBConn myconn = new DBConn();
//myconn.setDBName("shopping");
//myconn.DBConn();
//myconn.execute("Insert Into tbl_test(id,name) values(10,shandaer)");
//myconn.execute("Update tbl_test set name=yyyyyyyyyyyy where id=10");
//myconn.execute("Delete from tbl_test where id=1");
ResultSet rs = myconn.executeQuery("select * from tbl_user order by id desc limit 1"); //boolean hasData = myconn.hasData();
//System.out.println("has data:" + hasData);
//rs.first();
while (myconn.rs.next())
{
int id = myconn.rs_getInt("id") + 1;
System.out.print(id);
System.out.println(myconn.rs_getInt("id") + myconn.rs_getString("name"));
//System.out.println(¥n + myconn.rs_getHtmlString("name"));
//System.out.println(myconn.rs.getString("name") + myconn.rs_getInt(1));
}
}catch(Exception e){
System.err.println(e.toString());
}
}
}
声明:因为使用的是MySQL数据库,所以需要MySQL数据库的驱动
下载后请将org包放至DBConn.java所在目录下
以确保该bean能正常运行
三、编写用户注册的bean:reg.java
//reg.java
//import required classes
import java.sql.*;
public class reg
{
public int newID = 0;
public boolean result = false;
public boolean reg(String username,String password,String confirm,String email) {
try{
if(!this.checkUser(username))
return false;
if(!this.checkPwd(password))
return false;
if(!this.verifyPwd(password,confirm))
return false;
if(!this.checkEmail(email))
return false;
if(!https://www.360docs.net/doc/311813575.html,erNotExit(username))
return false;
this.getNewID();
this.result = this.register(username,password,confirm,email); return this.result;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}//End boolean reg
public boolean checkUser(String user)
{
try{
if(user.indexOf("")!=-1)
{
System.out.println("姓名中含有非法字符!");
return false;
}else
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public boolean checkPwd(String pwd)
{
try{
if(pwd.indexOf("")!=-1)
{
System.out.println("密码中含有非法字符!");
return false;
}else
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public boolean verifyPwd(String pwd,String confirm) {
try{
if(!pwd.equals(confirm))
{
System.out.println("两次输入的密码不一致!");
return false;
}else
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public boolean checkEmail(String email)
{
try{
if(email.indexOf("")!=-1)
{
System.out.println("E-mail中含有非法字符!");
return false;
}else
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public boolean userNotExit(String user)
{
try{
DBConn userDBConn = new DBConn();
userDBConn.executeQuery("select * from tbl_user where name=" + user + ""); if(userDBConn.rs_next())
{
System.out.println("用户名已存在,请选择其它的用户名!");
return false;
}else
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public int getNewID()
{
try{
DBConn newIDDBConn = new DBConn();
newIDDBConn.executeQuery("select * from tbl_user order by id desc limit 1"); if(newIDDBConn.rs_next())
{
this.newID = newIDDBConn.rs_getInt("id") + 1;
System.out.println(this.newID);
}else{
this.newID = 1;
}
return this.newID;
}catch(Exception e){
System.out.println(e.toString());
return -1;
}
}
public int getID()
{
return this.newID;
}
public boolean register(String username,String password,String confirm,String email)
{
try{
DBConn regDBConn = new DBConn();
String strSQL = "insert into tbl_user(id,name,pwd,email) values(" + this.newID +"," + username + "," + password + "," + email + ")";
regDBConn.execute(strSQL);
return true;
}catch(Exception e){
System.out.println(e.toString());
return false;
}
}
public static void main(String args[])
{
try{
reg newreg = new reg();
System.out.println(newreg.reg("sssssssss","ssssss","ssssss","imagebear@https://www.360docs.net/doc/311813575.html,"));
DBConn myconn = new DBConn();
myconn.executeQuery("select * from tbl_user");
while(myconn.rs_next())
{
System.out.println(myconn.rs_getInt("id") + " " + myconn.rs_getString("name") + " " + myconn.rs_getString("pwd") + " " + myconn.rs_getString("email"));
}
System.out.println(newreg.getID());
}catch(Exception e){
System.err.println(e.toString());
}
}
};
说明:
1、该bean文件应和上文所述DBConn.class文件放于同一目录下
2、本例主要研究注册的过程,其中的Email检测等方法并不完善,若要应用请自行设计方法
四、编写用户登陆的Servlet:login.java
//login.java
//import required classes
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
//class login
public class login extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
String username = req.getParameter("username");
String password = req.getParameter("password");
if(this.checklogin(username,password))
{
Cookie mylogin = new Cookie("username",username);
mylogin.setVersion(1);
mylogin.setPath("/");
mylogin.setComment("Your login username");
res.addCookie(mylogin);
}
//Cookie[] myCookies = req.getCookies();
//String nameValue = this.getCookieValue(myCookies,"username","not found"); //PrintWriter out = res.getWriter();
//out.println("username" + ":" + nameValue);
//out.println("Test Cookie Success!");
res.sendRedirect("/index.jsp");
}
public void doPost(HttpServletRequest req,HttpServletResponse res)
throws IOException,ServletException
{
doGet(req,res);
}
public static String getCookieValue(Cookie[] cookies,String cookieName,String defaultValue)
{
for(int i=0;i Cookie cookie = cookies[i]; if (cookieName.equals(cookie.getName())) return(cookie.getValue()); } return(defaultValue); } public boolean checklogin(String username,String password) { try{ DBConn loginConn = new DBConn(); loginConn.executeQuery("select * from tbl_user where name=" + username + ""); if(loginConn.rs_next()) { System.out.println("Connection created!"); if(loginConn.rs_getString("pwd").trim().equals(password)) { System.out.println(loginConn.rs_getString("name")); return true; } else { return false; } } System.out.println("Test Login Success!"); return false; }catch(Exception e){ System.out.println(e.toString()); return false; } } public static void main(String args[]) { login mylogin = new login(); System.out.println(mylogin.checklogin("shandong","shandong")); } } 说明: 1、默认的jdk1.4中并没有servlet包,请至sun公司网页下载servlet.jar,放至jdk目录下的jre¥lib¥目录下,并在JCreator中设置jdk处添加servlet.jar包 2、本Servlet用于检验用户名和密码,若正确则将用户名写入Cookie,完成后将当前页重定向到index.jsp页 五、编写检测用户是否已经登陆的bean:checkLogin.java //checkLogin.java 登陆界面设计 程序: import javax.swing.*; import java.awt.*; public class登陆界面设计extends JFrame{ public登陆界面设计(){ //构造方法名称要与类名称一致this.setTitle("学生系统登陆界面"); this.setForeground(Color.blue); this.setBounds(200, 200, 400, 400); this.setDefaultCloseOperation(EXIT_ON_CLOSE); JLabel labname=new JLabel("登陆名:"); JLabel labpassed=new JLabel("登陆密码:"); JTextField tex1=new JTextField(""); JTextField tex2=new JTextField(""); JButton bun1=new JButton("登陆"); JButton bun2=new JButton("退出"); JPanel panel =(JPanel) this.getContentPane(); panel.setLayout(null); panel.setBackground(Color.green); panel.add(labname); labname.setBounds(100, 60, 100, 30); // labname.setForeground(Color.red); labname.setFont(new Font(null,Font.ITALIC,20)); panel.add(tex1); tex1.setBounds(200, 60, 100, 30); // tex1.setForeground(Color.red); tex1.setFont(new Font(null,Font.ITALIC,20)); panel.add(labpassed); labpassed.setBounds(100, 120, 100, 30); // labpassed.setForeground(Color.red); labpassed.setFont(new Font(null,Font.ITALIC,20)); panel.add(tex2); tex2.setBounds(200, 120, 100, 30); // tex2.setForeground(Color.red); tex2.setFont(new Font(null,Font.ITALIC,20)); panel.add(bun1); bun1.setBounds(100, 180, 100, 50); bun1.setForeground(Color.red); bun1.setFont(new Font(null,Font.ITALIC,20)); panel.add(bun2); 1 html笔记 一、HTML的概述(了解) a.html是什么: hypertext markup language 超文本标记语言 超文本:音频,视频,图片称为超文本。. 标记:<英文单词或者字母>称为标记. 一个HTML页面都是由各种标记组成。 b.作用:编写HTML页面。 c.HTML语言不是一个编程语言(有编译过程),而是一个标记语言(没有编译过程). HTML页面直接由浏览器解析执行。 二、HTML的历史(了解) 三、HTML的网络术语(明白) * 网页:由各种标记组成的一个页面就叫网页 . * 主页(首页) : 一个网站的起始页面或者导航页面 . * 标记:称为开始标记 称为结束标记. 也叫标签.每个标签都规定好了特殊的含义。 * 元素:内容 称为元素. * 属性:给每一个标签所做的辅助信息。 * xhtml:符合XML语法标准的HTML。 * dhtml:dynamic,动态的。javascript + css + html 合起来的页面就是一个dhtml * http:协议标准。用来规定客户端浏览器和服务端交互时数据的一个格式。SMTP 邮件传输协议,ftp:文件传输协议. 四、HTML的编辑工具(了解) *.notepad 记事本 *.editplus : 语法高亮显示 技巧:根据颜色判断单词是否出错。(不是100%) *.ultraedit : 根据颜色判断单词是否出错,可以显示2进制数据. *.dw(dreamweaver,专业工具) 代码提示. 五、HTML的规范(知道) *.HTML是一个弱势语言 *.html 不区分大小写 *.html页面的后缀名是html或者htm(有一些系统不支持后缀名长度超过3个字符,比如dos系统) *.html 的结构 1)声明部分。主要作用是用来告诉浏览器这个页面使用的是那个标准。是HTML5标准。 2)head部分:不会显示在页面上。作用是告诉浏览器一些页面的额外信息。 3)body部分:我们缩写的代码必须放在此标签內。 六、HTML的各种标签(掌握) 明确:每个标签都有私有属性。也都有公有属性。 html中表示长度的单位都是像素。HTML只有一种单位就是像素。 body: bgcolor: 背景颜色 background:背景图片 package登陆界面; import java.awt.*; import java.awt.event.*; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.*; import主窗体.MainFrame; import https://www.360docs.net/doc/311813575.html,monaJdbc; public class Landing_interface extends JFrame implements ActionListener{ public static String str; JFrame jf=new JFrame("登录系统"); JPanel p1=new JPanel(); JPanel p2=new JPanel(); JPanel p3=new JPanel(); JPanel p4=new JPanel(); JPanel p5=new JPanel(); JPanel p6=new JPanel(); JPanel p7=new JPanel(); String username; static String passwd; JLabel name=new JLabel("用户名:"); static JTextField nametext=new JTextField(10); JLabel pwd=new JLabel("密码:"); JPasswordField password=new JPasswordField(10); JButton login=new JButton(""); public Landing_interface(){ 如何用photoshop输出html网页(psd网页模板) 2010-11-03 14:52 在修改好相应的文字与图象之后,我们就将PSD文件输出(X)HTML文件。首先得先对PSD文件做切片,有两种方法: ①使用工具栏上的“切片工具”, 然后在图象上划出一块一块的区域。 ②使用基于参考线的切片,按ctrl+R调出标尺栏, 把鼠标移动到标尺上,按住鼠标左键,移动到图象上,将会看到一条绿色的参考线,如图 将参考线;排好,然后点一下工具栏上的切片工具图表,然后点上面 选项栏里的“基于参考线的切片”。于是在原来的参考线上就变成了一块一块的切片了。 接下来就可以输出了: ①依次选择菜单栏上的“文件”→“存储为Web所用格式”→“存储”。 ②接下来就会弹出一个“将优化结果存储为”的窗口,如图 在“保存类型”处有个下拉列框可以选择,因为我们要存储为网页的格式,所以选择“HTML 和图象(* html)”,再选择“保存”就可以输出一个网页格式的HTML文件与一个包含图象的名为“images”的文件夹。 ③如果我们需要输出“div+css的网页”我们还可以这么做:在“设置”处的下拉列框,选择“其他” 就会弹出一个“输出设置”的窗口 在第2个下拉列框处选择“切片” 选择“生成CSS” 单击“好”→“保存”就可以输出一个目前流行的“div+css”的HTML网页。 其实标准的网制作完成的工作实际是:psd to html,一般情况下,我们会拿到美工的psd,这时候不同的人会有不同的做法: 1.打开fireworks将图片切割导出为html。 2.直接在dreamweaver之类的工具去拖拉布局,导入相关的图片,flash资源。 3.先在ps中完成切图后,在文本编辑器中看着效果图一步步的制作。 以上是大多被采用的方法,但都不好: 第一种方法最为不好,这样的代码根本不具维护性和可读性。 第二种方法也不好,代码难免会有冗余,做出来的东西基本需要排查一遍。 第三种方法也不好,因为你需要看效果图一点点的拼,也就是说写html标签的时候,你在不断的假设这块要怎么去显示。 正确的做法是: 1.拿到psd后,先不要做别的,直接在文本编辑器中将网页的框架写出来,不要假设这块将来css要去怎么渲染,完全自然化的标签,不加任何的css。 2.写完之后在各个浏览器运行之后确保大体定位都没有问题。 竭诚为您提供优质文档/双击可除html5自适应网页模板 篇一:35个响应式html5和css3模版 35个响应式html5和css3模版(1)20xx-07-0909:24佚名oschina我要评论(1)字号:t|t 下面提供了35个免费的响应式html5和css3模板,喜欢前端的朋友记得收藏哦。ad:20xx云计算架构师峰会超低价抢票中 免费响应式模版 Flexapp demo||download zgallering–FreeResponsivehtml5theme demo||download Responsivehtml5/css3template demo||download Vividphotohtml5andcss3templatedemo||download Responseevehtmltemplate demo||download brownieResponsivehtml5templatedemo||download Retina– FreeResponsivehtml5templatedemo||download digy demo||download obscura– FreeResponsivehtmltemplatedemo||download imcreativehtml5template demo||download 篇二:20xx年最棒的5个html5框架 20xx年最棒的5个html5框架 大多数的web开发者一直在用关键点来寻找动态的框架,这样能简化他们的设计和开发工作。 html5框架在所有的web浏览器和手机应用上都展现了 优秀的性能。它不仅简化了html5开发中css开发的沉重负担,还提高了网站的可见性。主要的原因是html5提供了独有的特征,例如特殊的架构标签,动画,浏览器支持等。 最近,大量的html5框架在行业内可免费获得,这使得html5开发者们不知道到底哪一个框架才是最好的。为了避 免上述问题,本文在下面会列出20xx年最流行的5个框架,让我们一起以一个简单的方式来开始讨论吧。 如果你是web设计者并准备用html5进行设计工作,现在是时候开始阅读了。ionic 竭诚为您提供优质文档/双击可除 个人网站模板html 篇一:初学者html的礼物模版网页代码 对于一个初学网页的学者,学习其基本的书写知识是一个网页高手必备的专业技能,此代码能让你在取悦女朋友的同时,深知代码的真谛! 保证能用,不能用你们可以骂我!!! 复制代码到txt文档,把该文档的后缀改成html 超级好玩,期待您的体验!!! 原来等待也可以如此的美丽,因为爱你。---http:// functionclick(){ if(event.button==2){ alert(送给一个我心爱的女孩!) } } document.onmousedown=click varmessage="如果爱上你也算是一种错,我深信这会是生命中最美丽的错,我情愿错一辈子......" varposition=100 vardelay=5 varscroll=newstatusmessageobject() functionstatusmessageobject(p,d){ this.msg=message this.out="" this.pos=position this.delay=delay this.i=0 this.reset=clearmessage} functionclearmessage(){ this.pos=position} functionscroller(){ for(scroll.i=0;scroll.i scroll.out+=""} if(scroll.pos>=0) scroll.out+=scroll.msg elsescroll.out=scroll.msg.substring(-scroll.pos,scr 最新文件---------------- 仅供参考--------------------已改成-----------word文本 --------------------- 方便更改 赠人玫瑰,手留余香。 package denglu; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.*; public class Dl extends JFrame{ private static final long serialVersionUID = 1L; Font f1=new Font("宋体", Font.PLAIN, 14); JLabel lb1,lb2,lb3,lb4; JButton b1,b2,b3; JComboBox cb; JTextField tf; JTextField pw; public void CreateJFrame(String title) { JFrame jf = new JFrame(title); Container container = jf.getContentPane(); lb1=new JLabel(new ImageIcon("image/tou.gif")); lb2=new JLabel(new ImageIcon("image/qqtou.gif")); jf.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } public static void main(String args[]) { // 在主方法中调用createJFrame()方法 new Dl().CreateJFrame("QQ登陆界面"); } } jp=new JPanel(); jp.setLayout(null); jp_jlb1=new JLabel(new ImageIcon("image/qqtou.gif")); jp_jlb1.setBounds(18, 10, 85, 85); //设置标签位置前提是要空布局 jp_jtf=new JTextField("QQ号码/手机/邮箱"); jp_jtf.setForeground(Color.LIGHT_GRAY);//设置颜色 jp_jtf.addMouseListener(this); jp_jtf.setBounds(118, 11, 170, 25); jp_pw=new TextField("密码",24); jp_pw.setForeground(Color.LIGHT_GRAY); jp_pw.addMouseListener(this); jp_pw.setBounds(118, 45, 170, 24); package library; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import https://www.360docs.net/doc/311813575.html,.PasswordAuthentication; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JRadioButton; import javax.swing.JTextField; public class login extends JFrame implements ActionListener { private JTextField namefield; private JTextField numfield; private JButton button; private String number; private AbstractButton button1; private JComboBox box; public login() { init(); } private void init() { setDefaultCloseOperation(EXIT_ON_CLOSE); setBounds(200, 200, 450, 400); setResizable(false); setLayout(null); setTitle("登录界面"); 竭诚为您提供优质文档/双击可除 html5文章页面模板 篇一:20个优秀的响应式设计html5网站模板 20个优秀的响应式设计html5网站模板想索取更多相关资料请加qq:649085085或登录 ps;本文档由北大青鸟广安门收集自互联网,仅作分享之用。 有了这些,你根本不需要再进国内哪些模板网站,哪些站虽然模板数量很多,但是对于我们来说,时间是宝贵的,我们只需要精品就可以了。请收藏、请分享,tks. legend响应式单页面网站模板 legendhtml5模板很漂亮,而且适合多用途网站,因为使用bootstrap框架搭建,所以支持bootstrap的插件,易于定制、扩展性灵活,是一个很不错的免费网站模板!下载模板|在线演试 stronglytyped stronglytyped 是一个免费的响应式设计模板, 使用html5/css3编写,包含基本的页面元素和页面。 下载模板|在线演试 codester codester这个html5模板使用了bootstrap构建,如果了解bootstrap的用户我想你一定会喜欢上它。 下载模板|在线演试 brushedtemplate brushed也是使用了twitterbootstrap框架搭建,并且对Retina显示屏优化 (iphone,ipad,ipodtouchandmacbookproRetina),非常适合作品展示使用。下载模板|在线演试 escapeVelocity escape是免费的响应式设计网站模板,并且使用了扁平化设计。 下载模板|在线演试 parallelism 很明显这个parallelism自适应网页模板适合相册、作品展示使用,还有一个强大之处就是网页图片的大小会自动适应,非常不错! import java.awt.BorderLayout; import java.awt.Color; import java.awt.FlowLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; public class text extends JFrame { /** * @param args */ public String str="左自强"; public String strc="1234567"; protected JButton a=new JButton("注册"); protected JButton b=new JButton("登录"); protected JPanel bb=new JPanel(); protected JLabel aa=new JLabel(" 如果你是新用户请先注册帐号"); text() { setLayout(new GridLayout(3,1)); bb.setLayout(new FlowLayout()); bb.add(a); bb.add(b); add(aa); add(bb); b.addActionListener(new ActionListener()//创建事件监听器 { @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub System.out.print("zuoziqiang"); loade jf=new loade(); jf.pack(); Java--登陆注册系统(数据库) import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.sql.*; public class DengLu extends JFrame implements ActionListener,KeyListener,ItemListener,FocusListener{ JLabel top,bott; JComboBox combobox; JPasswordField password; JButton b_login,b_regedit; JPanel panelMain,panel_center; public DengLu (){ super("登陆系统"); panelMain = new JPanel(new BorderLayout(10, 10)){ public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; super.paintComponent(g); Image img = Toolkit.getDefaultToolkit().getImage("G:\\image\\Denglubg.jpg"); g2.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this); } }; top = new JLabel (); top.setPreferredSize(new Dimension(this.getWidth(),30)); bott = new JLabel (); bott.setForeground(Color.white); bott.setPreferredSize(new Dimension(this.getWidth(),25)); centerBuild(); additem(); panelMain.add(top,BorderLayout.NORTH); panelMain.add(bott,BorderLayout.SOUTH); panelMain.add(panel_center,BorderLayout.CENTER); combobox.addItemListener(this); 竭诚为您提供优质文档/双击可除 个人中心html模板 篇一:三十款令人过目难忘的html5模板 三十款令人过目难忘的html5模板 当今世界,内容管理系统已经从网络手中夺取了大权,而我们几乎很难找到多少没有采用wordpress作为实现基础的网站——当然,这往往源自一种自然的愿望,即让事情变得更简单。但在今天的文章中,我们就要破除这种习惯思维。曾几何时,我们仍然在使用自己所熟知的html标记语言——这是构建网站过程中最简单也是最可靠的解决方案。没错,很多朋友可能会抱怨其使用感受极度糟糕,而且强迫管理员以手动方式更新网站上的所有内容。诚然,一切目标的达成都得付出代价,但html所能带来的收效要远远超出代码调 整过程中可能出现的难题(甚至根本不会出现什么难题)。让我们配合图片,一同看看那些令人过目难忘的html5模板。 首先,我们需要决定自己要构建哪种类型的网站。如果大家身为博主而且每周都会进行几次内容更新,那么html 可能确实不是我们应该优先考虑的选项。但我们再考虑另外几种情况。如果大家拥有一个商业网站或者个人页面组合, 而其作用主要是为了信息展示。这意味着我们希望访客能够浏览自己的网站、了解相关服务,但却用不着频繁地变更其中的内容。在这种情况下,html模板可能是解决需要的最佳手段。首先,html文件在服务器上所占用的空间更小,因此需要使用的带宽资源也更少。虽然这可能算不上什么了不起的优势,但知道自己的网站比其他竞争对手响应更快总归不是什么坏事。而更加值得一提的是,html在安全性方面更具优势。没人能够通过wp-admin破解我们的站点。为什么因 为html网站上根本就没有wp-admin这种东西,而且其中也没有数据库。为了攻破我们的网站,这帮恶意人士恐怕得跟jonathanjames本人拥有同样的技术水平才行。当然这些都 是题外话,让我们说回html模板。 本篇文章内提到的所有模板都为响应式方案。它们在任何现代设备上都能呈现出出色的外观效果,其中包括智能手机、平板设备甚至是我们上个月刚买的ipodtouch。同样的 效果在浏览器上亦可呈现。这些模板拥有良好的跨浏览器兼容能力,而且无论是在chrome及火狐等现代浏览器上、还 是ie等web开发者更喜爱的浏览器中,它们都同样表现优异。这些模板的设计堪称时尚,而且绝对能 给人留下深刻的印象。如果大家想尝试一款html5模板,但又不愿为此承担费用,那么请一定要认真保存下这些卓越、更重要的是完全免费的网站模板。好了,下面就让我们开始 竭诚为您提供优质文档/双击可除 html,提示页面模板 篇一:基于html语言的动态网页制作 题目: 学生姓名:学生学号:系别:专业:届别:指导教师:课程设计报告 基于html语言的动态网页制作房欢欢0908040206 电气信息工程学院 通信工程20xx届陈帅电气信息工程学院制 20xx年10月 基于html语言的动态网页制作 学生:房欢欢指导教师:陈帅电气信息工程学院 1课程设计的任务与要求1.1课程设计的任务 创建以苏州园林风景为主题的旅游网站,展示相关风景表达的主要信息。1.2课程设计的要求 制作一个动态网页,主题为旅游,包括首页动画、首页导航、园林简介、风景视频、网站留言。前台用户操作:包括网页浏览,欣赏音乐、视频,游客留言等功能。 1.3课程设计的研究基础 https://www.360docs.net/doc/311813575.html,简介https://www.360docs.net/doc/311813575.html,[1]是一个web开发平台,提供了构建企业级应用所需的服务、编程模型和软件基础结构。虽然https://www.360docs.net/doc/311813575.html,的语法基本上与其前辈asp(activeserverpage)兼容,但是https://www.360docs.net/doc/311813575.html,是一个全新的编程框架,旨在用于快速开发web应用程序。作为https://www.360docs.net/doc/311813575.html,平台的一部分,https://www.360docs.net/doc/311813575.html,提供了一种基于组件的、可扩展的且易于使用的方法,用于购建、部署和运行供所有在浏览器或移动设备中使用的web应用。同asp[2]和其他web[3]开发环境一样,https://www.360docs.net/doc/311813575.html,也是建立在http协议之上的,它利用http命令和策略进行双向的、浏览器到服务器的通信和协作。真正使https://www.360docs.net/doc/311813575.html,有别于其他web开发技术的是它提供的抽象编程模型,即web窗体模型。此外,整个https://www.360docs.net/doc/311813575.html,平台是https://www.360docs.net/doc/311813575.html,Framework的一部分。https://www.360docs.net/doc/311813575.html,应用是一些已编译的代码部件,由一些可重用且可扩展的组件组成,可以用第一类语言(包括、c#、https://www.360docs.net/doc/311813575.html,、https://www.360docs.net/doc/311813575.html,和j#)创建,并且可以访 问.netFramework中整个类的层次结构。2动态网页方案制做2.1方案提出 系统流程后台业务流程(管理员用户执行操作的流程)如图1所示: 图1网站后台管理系统流程图 2.2方案比较方案一:制作静态网页方案二:制作动态 JavaWeb项目实现登录注册 一. 电脑,eclipse,tomcat,mysql数据库 数据库连接架包 二.项目开始 1.打开eclipse创建一个新的JavaWeb项目,将下载的数据库连接架包放到WebContent 目录下的WEB-INFO中的lib下,右键加入构建路劲。 2.在WebContent下新建一个login.jsp的登录页面 代码如下: <%@page language="java"contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <% String path = request.getContextPath();//获取项目名String basePath = request.getScheme() + "://" + request.getServerName() + ":"+ request.getServerPort() + path + "/"; //项目的绝对路径 %> JAVA语言登陆界面设计
html网页布局模板
java 学生信息管理登陆界面
如何用photoshop输出html网页(psd网页模板)
html5自适应网页模板
个人网站模板html
QQ登录界面java代码(优选.)
基于java的图书管理系统登录界面
html5文章页面模板
java登录窗口代码
Java--登陆注册系统(模仿qq登陆界面)
个人中心html模板
html,提示页面模板
javaWeb项目实现简单的登录注册
登录页面
${message}