edituser_jsp.java

来自「jsp_javabean+tomcat的web管理系统!」· Java 代码 · 共 213 行

JAVA
213
字号
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;

public final class editUser_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');
      out.write('\n');
      msrv.NDBConn conn = null;
      synchronized (_jspx_page_context) {
        conn = (msrv.NDBConn) _jspx_page_context.getAttribute("conn", PageContext.PAGE_SCOPE);
        if (conn == null){
          conn = new msrv.NDBConn();
          _jspx_page_context.setAttribute("conn", conn, PageContext.PAGE_SCOPE);
        }
      }
      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\">\r\n");
      out.write("<!--\r\n");
      out.write("body {\r\n");
      out.write("\tmargin-left: 0px;\r\n");
      out.write("\tmargin-top: 0px;\r\n");
      out.write("\tmargin-right: 0px;\r\n");
      out.write("\tmargin-bottom: 0px;\r\n");
      out.write("}\r\n");
      out.write(".style1 {color: #FFFFFF}\r\n");
      out.write("-->\r\n");
      out.write("</style>\r\n");
      out.write("<link href=\"css/all.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("<style type=\"text/css\">\r\n");
      out.write("<!--\r\n");
      out.write(".style2 {color: #FF6600}\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");

   String sql="",tsu_id="",userSql="";
   String userID="",userPwd="",userName="",userFrom="",userDepart="",userGroupID="";
   ResultSet groupRS=null,userRS=null;
   if(request.getParameter("tsu_id")==null||request.getParameter("tsu_id").equals("")){
     out.println("参数传递错误!");
	 return;
   }else tsu_id=request.getParameter("tsu_id");
     sql="select tsg_id,tsg_name from tb_srv_group";
     userSql="select tsu_userID,tsu_pwd,tsu_name,tsu_from,tsu_depart,tsu_groupID from tb_srv_user where tsu_id="+tsu_id;
   try{
      groupRS=conn.executeQuery(sql);
	  userRS=conn.executeQuery(userSql);
   }catch(SQLException ex){
     out.println(ex.getMessage());
   }
   try{
     while(userRS.next()){
	   userID=userRS.getString(1);
	   userPwd=userRS.getString(2);
	   userName=userRS.getString(3);
	   userFrom=userRS.getString(4);
	   userDepart=userRS.getString(5);
	   userGroupID=userRS.getString(6);
	 }
   }catch(SQLException ex){out.println(ex.getMessage());}

      out.write("\r\n");
      out.write("<table width=\"98%\"  border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"1\" bgcolor=\"#CCCCCC\">\r\n");
      out.write("  <tr bgcolor=\"#F2F2F2\">\r\n");
      out.write("    <td height=\"20\" colspan=\"2\">&nbsp;用户资料</td>\r\n");
      out.write("  </tr>\r\n");
      out.write("  <form name=\"form1\" action=\"msrv.UserS\" method=\"post\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"21%\" height=\"17\" bgcolor=\"#FFFFFF\">&nbsp;用户帐号</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\"><input name=\"userID\" type=\"text\" readonly class=\"textbox\" id=\"userID2\" size=\"20\" value=\"");
      out.print(userID);
      out.write("\">\r\n");
      out.write("          <input type=\"hidden\" name=\"cntrl\" value=\"edit\"><input type=\"hidden\" name=\"tsu_id\" value=\"");
      out.print(tsu_id);
      out.write("\">\r\n");
      out.write("          <span class=\"style2\">*</span>用户登录帐号</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"17\" bgcolor=\"#FFFFFF\">&nbsp;用户密码</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\"><input name=\"userPwd\" type=\"password\" class=\"textbox\" id=\"userPwd2\" size=\"20\" value=\"");
      out.print(userPwd);
      out.write("\">\r\n");
      out.write("            \r\n");
      out.write("          <span class=\"style2\">*</span>长度为6-20个字符</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"17\" bgcolor=\"#FFFFFF\">&nbsp;确认密码</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\"><input name=\"confirmPwd\" type=\"password\" class=\"textbox\" id=\"confirmPwd\" size=\"20\" value=\"");
      out.print(userPwd);
      out.write("\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"18\" bgcolor=\"#FFFFFF\">&nbsp;真实姓名</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\"><input name=\"userName\" type=\"text\" class=\"textbox\" id=\"userName\" size=\"20\" value=\"");
      out.print(userName);
      out.write("\">\r\n");
      out.write("            \r\n");
      out.write("          <span class=\"style2\">*</span>最大长度为10个汉字</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"17\" bgcolor=\"#FFFFFF\">&nbsp;单  位</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\">\r\n");
      out.write("        <input name=\"userCompany\" type=\"text\" class=\"textbox\" id=\"userCompany\" size=\"30\" value=\"");
      out.print(userFrom);
      out.write("\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"17\" bgcolor=\"#FFFFFF\"> &nbsp;所在部门 </td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\"><input name=\"userDepartment\" type=\"text\" class=\"textbox\" id=\"userDepartment\" value=\"");
      out.print(userDepart);
      out.write("\" size=\"20\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td height=\"17\" bgcolor=\"#FFFFFF\">&nbsp;所属群组</td>\r\n");
      out.write("      <td bgcolor=\"#FFFFFF\">\r\n");
      out.write("        <select name=\"groupID\" id=\"select\">\r\n");
      out.write("          ");

		try{
		     while(groupRS.next()){
		
      out.write("\r\n");
      out.write("          <option value=\"");
      out.print(groupRS.getString(1));
      out.write('"');
      out.write(' ');
if(userGroupID.equals(groupRS.getString(1))) out.print("selected");
      out.write('>');
      out.print(groupRS.getString(2));
      out.write("</option>\r\n");
      out.write("          ");

		  }
		 }catch(SQLException ex){out.println(ex.getMessage());}
		 finally{
		    if(groupRS!=null){
			   groupRS.close();
			   groupRS=null;
			}
		 }
		
      out.write("\r\n");
      out.write("      </select></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr align=\"center\">\r\n");
      out.write("      <td height=\"17\" colspan=\"2\" bgcolor=\"#FFFFFF\"><input name=\"Submit\" type=\"submit\" class=\"button\" value=\"提交\">\r\n");
      out.write("        <input name=\"Submit2\" type=\"reset\" class=\"button\" value=\"重置\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </form>\r\n");
      out.write("  <tr bgcolor=\"F2F2F2\">\r\n");
      out.write("    <td height=\"5\" colspan=\"2\"></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
conn.close();
      out.write("\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 + =
减小字号Ctrl + -
显示快捷键?