Login.jsp
functionuserCheck(){
if(document.form1.username.value==""){
window.alert("请输入用户名");
returnfalse;
}
if(document.form1.pwd.value==""){
window.alert("请输入用户密码");
returnfalse;
}
returntrue;
}
用户名:
密 码:
Login_ok.jsp
<%
Stringusername=request.getParameter("username");
username=newString(username.getBytes("ISO8859_1"),"GBK");
Stringpwd=request.getParameter("pwd");
//out.print(username+pwd);
Stringspath="\\database\\data.mdb";//注意由网站根到文件的路径,用到了转义字符
Stringdbpath=application.getRealPath(spath);//转化成物理路径
Stringurl="jdbc:
odbc:
Driver={MicrosoftAccessDriver(*.mdb)};DBQ="+dbpath;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connectionconn=DriverManager.getConnection(url);
Statementstmt=conn.createStatement();
Stringsql="select*fromadminwhereusername='"+username+"'andpassword='"+pwd+"'";
//out.print(sql);
ResultSetrs=stmt.executeQuery(sql);
if(rs.next())
{
session.setAttribute("name",username);
out.print("登陆成功!
");
%>
forwardpage="main1.jsp"/> <% } else { out.print("用户名或密码错误,请重新登陆! "); } rs.close(); stmt.close(); conn.close(); %> Main1.jsp 对不起,您的浏览器不支持“框架”!
Menu.jsp
<%=session.getAttribute("name")%>欢迎你
Article.jsp
Cosplay.jsp
J
\JSP\code\jspBBS\WebContent\image\1.jpg"> \JSP\code\jspBBS\WebContent\image\2.jpg"> \JSP\code\jspBBS\WebContent\image\4.jpg"> \JSP\code\jspBBS\WebContent\image\5.jpg"> \JSP\code\jspBBS\WebContent\image\7.jpg"> \JSP\code\jspBBS\WebContent\image\8.jpg"> \JSP\code\jspBBS\WebContent\image\9.jpg"> \JSP\code\jspBBS\WebContent\image\10.jpg"> Bob.jsp <% if(session.getAttribute("name")==null) { response.sendRedirect("login.jsp"); } else { %> Bob \JSP\code\ch07access\WebContent\image\motion.jpg"> 五月的晴空,云散,天净如洗; 五月的热风,一路,将枝头的青杏催熟,将原野的麦浪染黄。 荼蘼架上的满眼繁芜,为残春画着最后的感叹号,夏却欢声笑语,盛装入驻。 抖落惜春的失意,抛开记忆的伤痛,从浮浮沉沉的梦里,醒来,绿叶成荫。 主题: 内容:"踩踩“更健康