📄 usermanage_0002ejsp_jsp.java
字号:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class userManage_0002ejsp_jsp extends HttpJspBase {
// begin [file="/userManage.jsp";from=(7,0);to=(7,86)]
// end
static {
}
public userManage_0002ejsp_jsp( ) {
}
private static boolean _jspx_inited = false;
public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
}
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;
String _value = null;
try {
if (_jspx_inited == false) {
synchronized (this) {
if (_jspx_inited == false) {
_jspx_init();
_jspx_inited = true;
}
}
}
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=GB2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
"", true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
// HTML // begin [file="/userManage.jsp";from=(0,0);to=(5,0)]
out.write("\r\n<html>\r\n<head>\r\n<title>用户信息管理</title>\r\n</head>\r\n");
// end
// HTML // begin [file="/userManage.jsp";from=(5,50);to=(6,0)]
out.write("\r\n");
// end
// HTML // begin [file="/userManage.jsp";from=(6,31);to=(7,0)]
out.write("\r\n");
// end
// begin [file="/userManage.jsp";from=(7,0);to=(7,86)]
com.test.DB.DBConnManager connManager = null;
boolean _jspx_specialconnManager = false;
synchronized (application) {
connManager= (com.test.DB.DBConnManager)
pageContext.getAttribute("connManager",PageContext.APPLICATION_SCOPE);
if ( connManager == null ) {
_jspx_specialconnManager = true;
try {
connManager = (com.test.DB.DBConnManager) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.test.DB.DBConnManager");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException (" Cannot create bean of class "+"com.test.DB.DBConnManager", exc);
}
pageContext.setAttribute("connManager", connManager, PageContext.APPLICATION_SCOPE);
}
}
if(_jspx_specialconnManager == true) {
// end
// begin [file="/userManage.jsp";from=(7,0);to=(7,86)]
}
// end
// HTML // begin [file="/userManage.jsp";from=(7,86);to=(13,0)]
out.write("\r\n<body bgcolor=\"#CFF1E1\">\r\n<br><br><br>\r\n<center><h2>\r\n用户信息管理平台\r\n</h2></center>\r\n");
// end
// begin [file="/userManage.jsp";from=(13,2);to=(17,0)]
Connection con=connManager.getConnection("access");
if(con==null)
{
// end
// HTML // begin [file="/userManage.jsp";from=(17,2);to=(18,0)]
out.write("对不起,现在数据库忙,请稍后再试\r\n");
// end
// begin [file="/userManage.jsp";from=(18,2);to=(30,0)]
}
Statement stmt=con.createStatement();
String userid=request.getParameter("userid");
if(userid!=null&&!userid.equals(""))
{
userid=new String(userid.getBytes("iso8859-1"), "gb2312");
out.println("<h3> 查找用户'"+userid+"'</h3>");
}
else{
out.println("<h3> 这儿是已经注册的所有用户:</h3>");
}
// end
// HTML // begin [file="/userManage.jsp";from=(30,2);to=(40,0)]
out.write("\r\n<table border=1 align=\"center\">\r\n<tr>\r\n<td>用户名</td>\r\n<td>姓名</td>\r\n<td>电子邮件</td>\r\n\r\n<td>修改</td>\r\n<td>删除</td>\r\n</tr>\r\n");
// end
// begin [file="/userManage.jsp";from=(40,2);to=(50,0)]
String sql="select * from Users";
if(userid!=null&&!userid.equals(""))
{
sql+=" where UserID like '%"+userid+"%'";
}
ResultSet rs=stmt.executeQuery(sql);
while(rs.next())
{
// end
// HTML // begin [file="/userManage.jsp";from=(50,2);to=(52,0)]
out.write("\r\n<tr>\r\n");
// end
// begin [file="/userManage.jsp";from=(52,2);to=(52,49)]
String UID=new String(rs.getString("UserID"));
// end
// HTML // begin [file="/userManage.jsp";from=(52,51);to=(53,4)]
out.write("\r\n<td>");
// end
// begin [file="/userManage.jsp";from=(53,7);to=(53,10)]
out.print(UID);
// end
// HTML // begin [file="/userManage.jsp";from=(53,12);to=(54,4)]
out.write("</td>\r\n<td>");
// end
// begin [file="/userManage.jsp";from=(54,7);to=(54,27)]
out.print(rs.getString("Name"));
// end
// HTML // begin [file="/userManage.jsp";from=(54,29);to=(55,4)]
out.write("</td>\r\n<td>");
// end
// begin [file="/userManage.jsp";from=(55,7);to=(55,28)]
out.print(rs.getString("Email"));
// end
// HTML // begin [file="/userManage.jsp";from=(55,30);to=(56,0)]
out.write("</td>\r\n");
// end
// begin [file="/userManage.jsp";from=(56,2);to=(56,28)]
int temp=rs.getInt("ID");
// end
// HTML // begin [file="/userManage.jsp";from=(56,30);to=(57,28)]
out.write("\r\n<td><a href=\"modify1.jsp?id=");
// end
// begin [file="/userManage.jsp";from=(57,31);to=(57,35)]
out.print(temp);
// end
// HTML // begin [file="/userManage.jsp";from=(57,37);to=(58,28)]
out.write("\">修改</a></td>\r\n<td><a href=\"delete1.jsp?id=");
// end
// begin [file="/userManage.jsp";from=(58,31);to=(58,35)]
out.print(temp);
// end
// HTML // begin [file="/userManage.jsp";from=(58,37);to=(58,45)]
out.write("&userid=");
// end
// begin [file="/userManage.jsp";from=(58,48);to=(58,51)]
out.print(UID);
// end
// HTML // begin [file="/userManage.jsp";from=(58,53);to=(60,0)]
out.write("\">删除</a></td>\r\n</tr>\r\n");
// end
// begin [file="/userManage.jsp";from=(60,2);to=(65,0)]
}
rs.close();
stmt.close();
connManager.releaseConnection("access",con);
// end
// HTML // begin [file="/userManage.jsp";from=(65,2);to=(79,0)]
out.write("\r\n</table>\r\n<p></p>\r\n<form action=\"userManage.jsp\" method=\"post\">\r\n <h3> 用户名:</h3>\r\n <center>\r\n <input type=\"text\" name=\"userid\">\r\n <input type=\"submit\" value=\"查找\">\r\n </center>\r\n</form>\r\n\r\n</body>\r\n</html>\r\n\r\n");
// end
} catch (Throwable t) {
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -