书签 分享 收藏 举报 版权申诉 / 18

类型JSP课程设计模板留言板设计.docx

  • 文档编号:5064460
  • 上传时间:2022-12-13
  • 格式:DOCX
  • 页数:18
  • 大小:561.68KB

(2)Index.jsp

<%pagecontentType="text/html;charset=GB2312"%>

留言板

<%includefile="head.txt"%>

欢迎使用留言板

(3)Register.jsp

<%pagecontentType="text/html;charset=GB2312"%>

<%includefile="head.txt"%>

<%taglibtagdir="/WEB-INF/tags"prefix="register"%>

</p><p>注册页面</p><p>

输入您的信息,用户名中不能含有符号。

用户名称:

*
设置密码:

*
联系:

真是:

电子:

<%

Stringlogname=request.getParameter("logname");

Stringmima=request.getParameter("mima");

Stringtel=request.getParameter("tel");

Stringrealname=request.getParameter("realname");

Stringemail=request.getParameter("email");

%>

Registerlogname="<%=logname%>"

mima="<%=mima%>"

tel="<%=tel%>"

realname="<%=realname%>"

email="<%=email%>"/>

返回的信息:

<%=backMess%>

(4)Register.tag

<%tagimport="java.sql.*"%>

<%tagpageEncoding="gb2312"%>

<%attributename="logname"required="true"%>

<%attributename="mima"required="true"%>

<%attributename="tel"required="true"%>

<%attributename="realname"required="true"%>

<%attributename="email"required="true"%>

<%variablename-given="backMess"scope="AT_END"%>

<%booleanboo=true;

if(logname!

=null){

if(logname.contains(",")||logname.contains(","))

boo=false;

}

if(boo){

try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

}

catch(ClassNotFoundExceptione){

out.print(e);//response.sendRedirect("error.jsp");

}

Connectioncon;

Statementsql;

ResultSetrs;

Stringcondition="INSERTINTOkuhuVALUES";

condition+="("+""+logname;

condition+="("+""+mima;

condition+="("+""+tel;

condition+="("+""+realname;

condition+="("+""+email;

try{

byte[]b=condition.getBytes("iso-8859-1");

condition=newString(b);

Stringuri="jdbc:

odbc:

mymoon";

con=DriverManager.getConnection(uri,"","");

sql=con.createstatement();

sql.executeUpdate(condition);

con.close();

byte[]c=logname.getBytes("iso-8859-1");

logname=newString(c);

Stringmess=logname+"注册成功";

jspContext.setAttribute("backMess",mess);

con.close();

}

catch(Exceptione){

jspContext.setAttribute("backMess","没有填写用户名或用户名已经被注册");

}

}

else{

jspContext.setAttribute("backMess","注册失败(用户名中不能有符号)");

}

%>

(5)Login.jsp

<%pagecontentType="text/html;charset=GB2312"%>

<%taglibtagdir="/WEB-INF/tags"prefix="login"%>

<%includefile="head.txt"%>

</p><p>登陆页面</p><p>



请您登陆

登陆名称:

输入密码:


<%

Stringlogname=request.getParameter("logname");

if(logname==null){

logname="";

}

Stringmima=request.getParameter("mima");

if(mima==null){

mima="";

}

%>

loginlogname="<%=logname%>"mima="<%=mima%>"/>

返回的信息:

<%=backMess%>

(6)Loglin.tag

<%tagimport="java.sql.*"%>

<%tagpageEncoding="gb2312"%>

<%attributename="logname"required="true"%>

<%attributename="mima"required="true"%>

<%variablename-given="backMess"scope="AT_END"%>

<%

byte[]a=logname.getBytes("iso-8859-1");

logname=newString(a);

byte[]b=nima.getBytes("iso-8859-1");

mima=newString(b);

Stringmess="";

try{Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");

}

catch(ClassNotFoundExceptione){

out.print(e);

}

Connectioncon;

Statementsql;

ResultSetrs;

stringloginMess=(String)session.getAttribute("logname");

if(loginMess==null){

loginMess="********************";

}

Stringstr=logname+","+mima;

if(loginMess.equal(str)){

mess=logname+"已经登陆";

}

else{

Stringuri="jdbc:

odbc:

mymoon";

boolenboo=(logname.length()>0)&&(mima.length()>0);

try{

con=DriverManager.getConnection(uri,"","");

Stringcondition=

"select*fromkehuwherelogname=""+

logname+""andmima=""+mima+"";

sql=con.createStatement();

if(boo){

rs=sql.executeQuery(condition);

booleanm=rs.next();

if(m==true){

mess=logname+"登陆成功"

str=logname+"","+mima;;

session.setAttribute("logname",str);

}

else{

mess="您输入的用户名"+logname+"不存在,或密码错误";

}

}

else

{

mess="还没有登陆或您输入的用户名不存在或密码错误。

";

}

con.close();

}

catch(SQLExceptionexp){

mess="问题:

"+exp;

}

}

jspContext.setAttribute("backMess",mess);

%>

(7)Submit.jsp

<%pagecontentType="text/html;charset=GB2312"%>

输入您的名字:


输入您的留言标题:


输入您的留言:



(8)messagePane.jsp

<%pagecontentType="text/html;Charset=GB2312"%>

<%pageimport="java.util.*"%>

<%!

Vectorv=newVector();

ServletContextapplication;

synchronizedvoidsendMessage(Strings){

application=getServletContext();;

v.add(s);

application.setAttribute("Mess",v);

}

%>

<%Stringname=request.getParameter("peopleName");

Stringtitle=request.getParameter("Title");

Stringmessages=request.getParameter("messages");

if(name==null){

name="guest"+(int)(Math.random()*10000);

}

if(title==null){

title="无标题";

}

if(messages==null){

messages="无信息";

}

Stringtime=newDate().toString();

Strings="#"+name+"#"+title+"#"+time+"#"+messages+"#";

sendMessage(s);

out.print("您的信息已提交!

");

%>

返回

查看留言板

(9)showMessage.jsp

<%pagecontentType="text/html;Charset=GB2312"%>

<%pageimport="java.util.*"%>

<%Vectorv=(Vector)application.getAttribute("Mess");

out.print("");

out.print("");

out.print(""+"留言者"+"");

out.print(""+"留言标题"+"");

out.print(""+"留言时间"+"");

out.print(""+"留言容"+"");

out.print("");

for(inti=0;i

out.print("");

Stringmessage=(String)v.elementAt(i);

StringTokenizerfenxi=newStringTokenizer(message,"#");

out.print("");

intnumber=fenxi.countTokens();

for(intk=0;k

Stringstr=fenxi.nextToken();

if(k

out.print(""+str+"");

}

else{

out.print(""+str+"

配套讲稿:

如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。

特殊限制:

部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。

关 键  词:
JSP 课程设计 模板 留言板 设计
提示  冰豆网所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。
关于本文
本文标题:JSP课程设计模板留言板设计.docx
链接地址:https://www.bdocx.com/doc/5064460.html
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2008-2022 冰点文档网站版权所有

经营许可证编号:鄂ICP备2022015515号-1

收起
展开