⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modimy_jsp.java

📁 jsp mysql 实现网上购物系统
💻 JAVA
字号:
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import com.mybusiness.web.ware.shopuser;

public final class modimy_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,
      			null, 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");


String username = (String)session.getAttribute("username");
if ( username == null || username.equals("") ){
	response.sendRedirect("login.jsp?msg=nologin");
}


      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      com.mybusiness.web.usermn user = null;
      synchronized (_jspx_page_context) {
        user = (com.mybusiness.web.usermn) _jspx_page_context.getAttribute("user", PageContext.PAGE_SCOPE);
        if (user == null){
          user = new com.mybusiness.web.usermn();
          _jspx_page_context.setAttribute("user", user, PageContext.PAGE_SCOPE);
        }
      }
      out.write('\r');
      out.write('\n');

long userid=0;
String mesg = "";

String submit = (String)request.getParameter("submit");
if (submit!=null && !submit.equals("")){		
	if(user.update(request)){		
		mesg = "用户资料修改成功!";	
	}else {
		mesg = "对不起,你提交的参数有错误!" +  user.getMessage();;
	}
}
String UserId = (String)session.getAttribute("userid");
if (UserId!=null && !UserId.equals("")) {
	try {
		userid = Long.parseLong(UserId);
		if (!user.getUserinfo(userid)) {
			mesg = "要修改的用户信息不存在";
		}
	} catch(Exception e) {
		mesg = "该用户号不存在!";
	}
}



      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head>\r\n");
      out.write("<title>商场翱游购物系统 修改个人信息</title>\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
      out.write("<script language=\"javascript\">\r\n");
      out.write("\r\n");
      out.write("function checkform() {\r\n");
      out.write("\tif (document.form1.username.value==\"\"){\r\n");
      out.write("\t\talert(\"用户名不能为空\");\r\n");
      out.write("\t\tdocument.form1.username.focus();\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\tif (document.form1.passwd.value==\"\"){\r\n");
      out.write("\t\talert(\"用户密码不能为空\");\r\n");
      out.write("\t\tdocument.form1.passwd.focus();\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\tif (document.form1.passwd.value!=document.form1.passconfirm.value){\r\n");
      out.write("\t\talert(\"确认密码不相符!\");\r\n");
      out.write("\t\tdocument.form1.passconfirm.focus();\r\n");
      out.write("\t\treturn false;\r\n");
      out.write("\t}\r\n");
      out.write("\t\r\n");
      out.write("\treturn true;\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("</script>\r\n");
      out.write("<link rel=\"stylesheet\" href=\"books.css\" type=\"text/css\">\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body  background=images/112.gif text=\"#000000\">\r\n");
      out.write("<div align=\"center\">\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr> \r\n");
      out.write("      <td width=\"120\" align=\"center\"><img src=\"images/Img20625.jpg\" width=\"50\" height=\"50\"><br>\r\n");
      out.write("        <font color=\"#0066CC\">商场翱游购物系统</font></td>\r\n");
      out.write("      <td align=\"center\"><img src=\"images/baners2.gif\" width=\"592\" height=\"83\"></td>\r\n");
      out.write("      <td align=\"center\" width=\"80\"><a href=\"#\"></a><br>\r\n");
      out.write("        <br>\r\n");
      out.write("      </td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr> \r\n");
      out.write("      <td width=\"200\">&nbsp;</td>\r\n");
      out.write("      <td width=\"55\"><a href=\"index.jsp\">首页</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"warelist.jsp\">在线购物</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"shoperlist.jsp\">我的购物车</a></td>\r\n");
      out.write("      <td width=\"100\"><a href=\"userinfo.jsp\">用户信息</a></td>\r\n");
      out.write("      <td>&nbsp;</td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  <br>\r\n");
      out.write("  <table width=\"750\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("    <tr valign=\"top\"> \r\n");
      out.write("      <td width=\"186\" align=\"center\"> \r\n");
      out.write("        <table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td><img src=\"images/baobei%5B1%5D.gif\" width=\"120\" height=\"60\"></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td><a href=\"userinfo.jsp\">查看订单情况</a></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("          <tr> \r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td><a href=\"modimy.jsp\">修改个人信息</a></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("          <tr>\r\n");
      out.write("            <td width=\"20\">&nbsp;</td>\r\n");
      out.write("            <td><a href=\"shoperlist.jsp\">查看我的购物车</a></td>\r\n");
      out.write("          </tr>\r\n");
      out.write("        </table>\r\n");
      out.write("        <p><img src=\"images/v3_sun_logo.gif\" width=\"64\" height=\"28\"></p>\r\n");
      out.write("        <p>&nbsp;</p>\r\n");
      out.write("      </td>\r\n");
      out.write("      <td align=\"center\"> <br>修改我的个人信息<br>\r\n");
      out.write("        \t\t");
 if (!mesg.equals("")){
			out.println("<br><font color=red>"+ mesg +"</font><br><br>"); 
		} else {
			shopuser userinfo = (shopuser)user.getUserlist().elementAt(0);
		
      out.write("\r\n");
      out.write("\t<FORM name=\"form1\" METHOD=POST ACTION=\"modimy.jsp\">\r\n");
      out.write("\t<table width=\"95%\" border=\"1\" cellspacing=\"1\" cellpadding=\"1\" bordercolor=\"#2DAE2D\">\r\n");
      out.write("\t\r\n");
      out.write("\t  <tr><td align=right width=100>用户名</td>\r\n");
      out.write("\t    <td>");
      out.print( userinfo.getUserName() );
      out.write("\r\n");
      out.write("\t\t  <input type=\"hidden\" name=\"username\" maxlength=\"20\" size=\"14\" value=\"");
      out.print( userinfo.getUserName() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>用户密码:</td>\r\n");
      out.write("\t\t<td><input type=\"password\" name=\"passwd\" maxlength=\"20\" size=\"14\" value=\"");
      out.print( userinfo.getPassWord() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>确认密码:</td>\r\n");
      out.write("\t\t<td><input type=\"password\" name=\"passconfirm\" maxlength=\"20\" size=\"14\" value=\"");
      out.print( userinfo.getPassWord() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>用户真名</td>\r\n");
      out.write("\t\t<td> <input type=\"text\" name=\"names\" maxlength=\"20\" size=\"14\" value=\"");
      out.print( userinfo.getNames() );
      out.write("\" ></td></tr>\r\n");
      out.write("\t  <tr><td align=right width=100>性别</td>\r\n");
      out.write("\t    <td><select name=\"sex\">\r\n");
      out.write("            <option ");
 if (userinfo.getSex().equals("男")) out.print("selected"); 
      out.write(" >男</option>\r\n");
      out.write("            <option ");
 if (userinfo.getSex().equals("女")) out.print("selected"); 
      out.write(" >女</option>\r\n");
      out.write("          </select>\r\n");
      out.write("\t\t\t</td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>联系地址</td>\r\n");
      out.write("\t\t<td><input type=\"text\" name=\"address\" maxlength=\"150\" size=\"40\" value=\"");
      out.print( userinfo.getAddress() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>联系电话</td>\r\n");
      out.write("\t\t<td><input type=\"text\" name=\"phone\" maxlength=\"25\" size=\"16\" value=\"");
      out.print( userinfo.getPhone() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>邮编</td>\r\n");
      out.write("\t\t<td><input type=\"text\" name=\"post\" maxlength=\"8\" size=\"8\" value=\"");
      out.print( userinfo.getPost() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>电子邮件</td>\r\n");
      out.write("\t\t<td><input type=\"text\" name=\"email\" maxlength=\"50\" size=\"25\" value=\"");
      out.print( userinfo.getEmail() );
      out.write("\" ></td></tr> \r\n");
      out.write("\t  <tr><td align=right width=100>&nbsp;</td>\r\n");
      out.write("\t\t<td><INPUT TYPE=\"hidden\" name=\"userid\" value=\"");
      out.print( userinfo.getId() );
      out.write("\">\r\n");
      out.write("\t\t\t<INPUT TYPE=\"submit\" name=\"submit\" value=\"修改\" onclick=\"return(checkform());\">\r\n");
      out.write("\t\t\t<INPUT TYPE=\"reset\" name=\"reset\" value=\"取消\"></td></tr> \r\n");
      out.write("\t</FORM>\r\n");
      out.write("  </table>\r\n");
      out.write("  <br>\r\n");
}
      out.write("          \r\n");
      out.write("        <p>&nbsp;</p>\r\n");
      out.write("        </td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("\r\n");
      out.write("  <table width=\"70%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td align=\"center\">开发:王文耀<br>\r\n");
      out.write("        CopyRight@2006<br>\r\n");
      out.write("        Email:<a href=\"mailto:wwy170@163.com\">wwy170@163.com</a></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  \r\n");
      out.write("</div>\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 + -