📄 modify2_0002ejsp_jsp.java
字号:
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
public class modify2_0002ejsp_jsp extends HttpJspBase {
// begin [file="/modify2.jsp";from=(6,0);to=(6,86)]
// end
static {
}
public modify2_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="/modify2.jsp";from=(0,0);to=(4,0)]
out.write("<html>\r\n<head>\r\n<title>将修改后的用户信息存到数据库</title>\r\n</head>\r\n");
// end
// HTML // begin [file="/modify2.jsp";from=(4,50);to=(5,0)]
out.write("\r\n");
// end
// HTML // begin [file="/modify2.jsp";from=(5,31);to=(6,0)]
out.write("\r\n");
// end
// begin [file="/modify2.jsp";from=(6,0);to=(6,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="/modify2.jsp";from=(6,0);to=(6,86)]
}
// end
// HTML // begin [file="/modify2.jsp";from=(6,86);to=(11,0)]
out.write("\r\n<body bgcolor=\"#CFF1E1\">\r\n<center><h2>\r\n将修改后的用户信息存到数据库\r\n</h2></center>\r\n");
// end
// begin [file="/modify2.jsp";from=(11,2);to=(28,0)]
int id=0;
try{
id=Integer.parseInt(request.getParameter("id").toString());
}catch(Exception e)
{
out.println("链接错误");
out.close();
}
String userid=request.getParameter("userid");
String name=new String(request.getParameter("name").getBytes("iso8859_1"),"gb2312");
String email=request.getParameter("email");
if(userid==null||name==null||email==null||userid.equals("")||name.equals("")||email.equals("")){
out.println("填写不完整,<a href='javascript:history.back();'>请返回</a>");
out.close();
}
// end
// HTML // begin [file="/modify2.jsp";from=(28,2);to=(29,0)]
out.write("\r\n");
// end
// begin [file="/modify2.jsp";from=(29,2);to=(33,0)]
Connection con = connManager.getConnection("access");
if(con==null)
{
// end
// HTML // begin [file="/modify2.jsp";from=(33,2);to=(34,0)]
out.write("对不起,现在数据库忙,请稍后再试\r\n");
// end
// begin [file="/modify2.jsp";from=(34,2);to=(36,0)]
}
// end
// HTML // begin [file="/modify2.jsp";from=(36,2);to=(37,0)]
out.write("\r\n");
// end
// begin [file="/modify2.jsp";from=(37,2);to=(49,0)]
Statement stmt = con.createStatement();
int value=stmt.executeUpdate("update Users set UserID='"+userid+"' , Name='"+name+"', Email='"+email+"' where ID="+id);
if(value>0)
{
out.println("修改成功!<a href=userManage.jsp>请返回</a>");
}else
{
out.println("修改失败!<a href=userManage.jsp>请返回</a>");
}
stmt.close();
connManager.releaseConnection("access",con);
// end
// HTML // begin [file="/modify2.jsp";from=(49,2);to=(52,0)]
out.write("\r\n</body>\r\n</html>\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 + -