📄 login_jsp.java
字号:
package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import sms.db.*;
import sms.bean.*;
public final class login_jsp extends org.apache.jasper.runtime.HttpJspBase
implements org.apache.jasper.runtime.JspSourceDependent {
private static java.util.Vector _jspx_dependants;
public java.util.List getDependants() {
return _jspx_dependants;
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
request.setCharacterEncoding("gb2312");
String commitFlag = (String)request.getParameter("submintButton");//得到按钮事件
String studentId = request.getParameter("studentId");
String pwd = request.getParameter("pwd");
StudentBean studentBean = null;
if(commitFlag != null){//如果单击了确定按钮
StudentBean studentBean2 = new StudentBean();
studentBean = studentBean2.queryStuInfo(studentId,pwd);//查询是否存在该学生信息
if(studentBean != null){//如果存在该学生信息
session.setAttribute("studentBean",studentBean);//将代表该学生信息的Bean保存在session中
RequestDispatcher dispatcher = request.getRequestDispatcher("/loginSuccess.jsp");
dispatcher.forward(request,response);
}
else{//调用脚本语言提示
out.write("\r\n");
out.write(" <script language=\"javascript\" type=\"\">\r\n");
out.write(" alert('请检查学号,密码是否正确!');\r\n");
out.write(" </script>\r\n");
out.write(" ");
}
}
out.write("\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
out.write("<title>登录</title>\r\n");
out.write("<style type=\"text/css\"></style>\r\n");
out.write("<link href=\"css/style.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
out.write("<style type=\"text/css\">\r\n");
out.write(".style1 {font-family: \"华文中宋\"}\r\n");
out.write("body {\r\n");
out.write("\tbackground-color: #CCCCCC;\r\n");
out.write("}\r\n");
out.write("body,td,th {\r\n");
out.write("\tcolor: #330066;\r\n");
out.write("}\r\n");
out.write("</style>\r\n");
out.write("</head>\r\n");
out.write("\r\n");
out.write("<body>\r\n");
out.write("<table width=\"99%\" border=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"71\" colspan=\"3\"><h1>请您先登录系统</h1></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"13%\" height=\"203\"> </td>\r\n");
out.write(" <td width=\"42%\">\r\n");
out.write("\t<form action=\"login.jsp\" method=\"post\" name=\"form1\">\r\n");
out.write(" <input type=hidden name=\"commitFlag\" value=\"submit\">\r\n");
out.write("\t<table width=\"100%\" border=\"0\">\r\n");
out.write(" <tr>\r\n");
out.write(" <td width=\"46%\" height=\"56\" align=\"right\"><span class=\"style2\">学号:</span></td>\r\n");
out.write(" <td width=\"54%\"><input name=\"studentId\" type=\"text\" class=\"text1\" size=\"10\" maxlength=\"10\"></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"47\" align=\"right\"><span class=\"style2\">密码: </span></td>\r\n");
out.write(" <td><input name=\"pwd\" type=\"password\" class=\"text1\" size=\"10\" maxlength=\"10\"></td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"40\" align=\"right\"> </td>\r\n");
out.write(" <td align=\"left\">\r\n");
out.write("\t\t <input name=\"submintButton\" type=\"submit\" class=\"button1\" value=\"确定\" >\r\n");
out.write(" \r\n");
out.write("<input name=\"reset\" type=\"reset\" class=\"button1\" id=\"reset\" value=\"取消\">\r\n");
out.write("</td>\r\n");
out.write(" </tr>\r\n");
out.write(" </table>\r\n");
out.write("\t</form>\r\n");
out.write("\t</td>\r\n");
out.write(" <td width=\"45%\"> </td>\r\n");
out.write(" </tr>\r\n");
out.write(" <tr>\r\n");
out.write(" <td height=\"235\"> </td>\r\n");
out.write(" <td> </td>\r\n");
out.write(" <td> </td>\r\n");
out.write(" </tr>\r\n");
out.write("</table>\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
} catch (Throwable t) {
if (!(t instanceof SkipPageException)){
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
}
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -