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

📄 modify_person_info.jsp

📁 计算机技术的快速发展
💻 JSP
📖 第 1 页 / 共 3 页
字号:
<%@page contentType="text/html; charset=gb2312" language="java" errorPage="error.jsp"%>
<%@page import="com.suninformation.*,com.suninformation.user.*,com.suninformation.tools.*,java.sql.Date"%>
<%request.setCharacterEncoding("gb2312");%>
<html>
<head>
<title>修改用户详细信息 - 沈航网络</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript" src="Includes/functionForUser.js"></script>
<link href="Includes/user.css" rel="stylesheet" type="text/css">
<style type="text/css">
  <!--
    body {
    background-image: url(Images/bg.jpg);
    }
    body,td,th {
    font-size: 12px;
    }
  -->
</style>
<link href="Includes/im.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#ffffff">
<%
  String UserName = ParamUtils.getParameter(request, "username");
  String sessionUserName = (String) session.getAttribute("userName");
  boolean ModifyPersonInfo = ParamUtils.getBooleanParameter(request, "modifyuserinfo", false);
  boolean errorLogin = true;
  String errMsg = "<ui>";
  String RealName = null;
  int Sex = -1;
  String Nation = null;
  int Birthday_Year = -1;
  int Birthday_Month = -1;
  int Birthday_Day = -1;
  Date Birthday = null;
  int Height = -1;
  int Marriage = -1;
  String SchoolName = null;
  int SchoolAge = -1;
  String WorkpraceName = null;
  String WorkpraceAddress = null;
  String HomeAddress = null;
  String ContactAddress = null;
  String Postalcode = null;
  String ContactPhone = null;
  String MobileTelephone = null;
  int JobName = -1;
  int Pay = -1;
  int Country = -1;
  int City = -1;
  String QQ = null;
  String ICQ = null;
  String Other = null;
  String Email = null;
  String HomePage = null;
  String Memo = null;
  boolean ModifyUserInfo = false;
  boolean errorRealName = false;
  boolean errorSex = false;
  boolean errorNation = false;
  boolean errorBirthday = false;
  boolean errorContactAddress = false;
  boolean errorPostalcode = false;
  boolean errorContactPhone = false;
  boolean errorCity = false;
  boolean errorEmail = false;
  boolean errorUserNotFound = false;
  boolean errors = false;
  boolean succ = false;
  //用户是否登陆了。{
  if ("null".equals(UserName)) {
    UserName = null;
  }
  if (UserName != null && sessionUserName != null) {
    if (UserName.equals(sessionUserName)) {
      errorLogin = false;
    }
    else {
      errorLogin = true;
    }
  }
  if (errorLogin) {
    throw new UserNotFoundException("): Sorry,您可能还未登陆或已经超时了!<br>请重新<a href=\"login.jsp\">登陆</a>。");
  }
  //页面处理部分
  if (!errorLogin && ModifyPersonInfo && request.getMethod().equals("POST")) {
	errMsg = "<ui>";
	RealName = ParamUtils.getParameter(request, "realname");
	Sex = ParamUtils.getIntParameter(request, "sex", -1);
	Nation = ParamUtils.getParameter(request, "nation");
	Birthday_Year = ParamUtils.getIntParameter(request, "birthday_year", -1);
	Birthday_Month = ParamUtils.getIntParameter(request, "birthday_month", -1);
	Birthday_Day = ParamUtils.getIntParameter(request, "birthday_day", -1);
	Birthday = CheckValue.isSQLDate(Birthday_Year, Birthday_Month, Birthday_Day);
	Height = ParamUtils.getIntParameter(request, "height", -1);
	Marriage = ParamUtils.getIntParameter(request, "marriage", -1);
	SchoolName = ParamUtils.getParameter(request, "schoolname");
	SchoolAge = ParamUtils.getIntParameter(request, "schoolage", -1);
	WorkpraceName = ParamUtils.getParameter(request, "workpracename");
	WorkpraceAddress = ParamUtils.getParameter(request, "workpraceaddress");
	HomeAddress = ParamUtils.getParameter(request, "homeaddress");
	ContactAddress = ParamUtils.getParameter(request, "contactaddress");
	Postalcode = ParamUtils.getParameter(request, "postalcode");
	ContactPhone = ParamUtils.getParameter(request, "contactphone");
	MobileTelephone = ParamUtils.getParameter(request, "mobiletelephone");
	JobName = ParamUtils.getIntParameter(request, "jobname", -1);
	Pay = ParamUtils.getIntParameter(request, "pay", -1);
	Country = ParamUtils.getIntParameter(request, "country", -1);
	City = ParamUtils.getIntParameter(request, "city", -1);
	QQ = ParamUtils.getParameter(request, "qq");
	ICQ = ParamUtils.getParameter(request, "icq");
	Other = ParamUtils.getParameter(request, "other");
	Email = ParamUtils.getParameter(request, "email");
	HomePage = ParamUtils.getParameter(request, "hemepage");
	Memo = ParamUtils.getParameter(request, "memo");
	ModifyUserInfo = ParamUtils.getBooleanParameter(request, "modifyuserinfo", false);

    if (RealName == null || RealName.length() > 10) {
      errorRealName = true;
    }
    if (Sex < 0 || Sex > 1) {
      errorSex = true;
    }
    if (Nation == null || Nation.length() > 15) {
      errorNation = true;
    }
    if (Birthday == null) {
      errorBirthday = true;
    }
    if (ContactAddress == null || ContactAddress.length() > 100) {
      errorContactAddress = true;
    }
    if (Postalcode == null || Postalcode.length() > 6) {
      errorPostalcode = true;
    }
    else if (!CheckValue.isNumber(Postalcode)) {
      errorPostalcode = true;
    }
    if (ContactPhone == null || ContactPhone.length() > 20) {
      errorContactPhone = true;
    }
    if (Email == null || Email.indexOf("@") < 1 || Email.indexOf(".") < 1 || Email.length() > 50) {
      errorEmail = true;
    }
	if (City == -1) {
		errorCity = true;
	}
    errors = errorRealName || errorSex || errorNation || errorBirthday || errorContactAddress || errorPostalcode || errorContactPhone || errorEmail || errorCity;
    if (!errors) {
      try {
        UserInfo ui = UserManager.getUserProxy().getUserInfoProxy().getUserInfo(UserName);
        ui.setRealName(RealName);
        ui.setSex(Sex);
        ui.setNation(Nation);
        ui.setBirthday(Birthday);
        ui.setContactAddress(ContactAddress);
        ui.setPostalcode(Postalcode);
        ui.setContactPhone(ContactPhone);
        ui.setCity(City);
        ui.setEmail(Email);
        if (Height != -1) {
          ui.setHeight(Height);
        }
        if (Marriage != -1) {
          ui.setMarriage(Marriage);
        }
        if (SchoolName != null && SchoolName.length() <= 20) {
          ui.setSchoolName(SchoolName);
        }
        if (SchoolAge != -1) {
          ui.setSchoolAge(SchoolAge);
        }
        if (WorkpraceName != null && WorkpraceName.length() <= 50) {
          ui.setWorkpraceName(WorkpraceName);
        }
        if (WorkpraceAddress != null && WorkpraceAddress.length() <= 100) {
          ui.setWorkpraceAddress(WorkpraceAddress);
        }
        if (HomeAddress != null && HomeAddress.length() <= 100) {
          ui.setHomeAddress(HomeAddress);
        }
        if (MobileTelephone != null && MobileTelephone.length() <= 20) {
          ui.setMobileTelephone(MobileTelephone);
        }
        if (JobName != -1) {
          ui.setJobName(JobName);
        }
        if (Pay != -1) {
          ui.setPay(Pay);
        }
        if (Country != -1) {
          ui.setCountry(Country);
        }
        if (QQ != null && QQ.length() <= 15) {
          ui.setQq(QQ);
        }
        if (ICQ != null && ICQ.length() <= 15) {
          ui.setIcq(ICQ);
        }
        if (Other != null && Other.length() <= 50) {
          ui.setOther(Other);
        }
        if (HomePage != null && HomePage.length() <= 100) {
          ui.setHomePage(HomePage);
        }
        if (Memo != null && Memo.length() <= 500) {
          ui.setMemo(Memo);
        }
        UserManager.getUserProxy().getUser(UserName).setDataIsFull(1);
        succ = true;
        ui.save();
      }
      catch (UserNotFoundException e) {
        errors = true;
        errorUserNotFound = true;
      }
    }
    if (errors) {
      if (errorRealName) {
        errMsg = errMsg + "<li>真实姓名输入错误。</li>";
      }
      if (errorSex) {
        errMsg = errMsg + "<li>性别输入错误。</li>";
      }
      if (errorNation) {
        errMsg = errMsg + "<li>民族输入错误。</li>";
      }
      if (errorBirthday) {
        errMsg = errMsg + "<li>出生日期输入错误。</li>";

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -