<%@ page language="java" contentType="text/html; charset=GB18030"pageEncoding="GB18030"%>
<!-- 引入命名空间 --><%@ page import="com.bjpowernode.drp.sysmgr.domain.*" %><%@ page import="com.bjpowernode.drp.sysmgr.manager.*" %><!-- 服务器端代码 --><%//设置字符集,防止保存到数据库中出现乱码情况request.setCharacterEncoding("GB18030");
String command=request.getParameter("command");if ("add".equals(command)){//获取提交表单的数据,并将其设置到User实体中User user=new User();user.setUserId(request.getParameter("userId"));user.setUserName(request.getParameter("userName"));user.setPassword(request.getParameter("password"));user.setContactTel(request.getParameter("contactTel"));user.setEmail(request.getParameter("email"));//调用后台用户管理类,完成用户添加UserManager.getInstance().addUser(user);out.println("添加用户成功!");}%><html><head><meta http-equiv="Content-Type" content="text/html; charset=GB18030"><title>添加用户</title><link rel="stylesheet" href="../style/drp.css"><script src="../script/client_validate.js"></script><script type="text/javascript">function addUser() {//form表单提交(提交到自身JSP页面,在服务端进行接收)with (document.getElementById("userForm")){action="user_add.jsp";method="post";submit();}}
</script></head><body class="body1" onload="init()"><form name="userForm" target="_self" id="userForm"><input type="hidden" name="command" value="add"><div align="center"><table width="95%" border="0" cellspacing="0" cellpadding="0"height="25"><tr><td width="522" class="p1" height="25" nowrap><img src="../images/mark_arrow_03.gif" width="14" height="14"><b>系统管理>>用户维护>>添加</b></td></tr></table><hr width="97%" align="center" size=0><table width="95%" border="0" cellpadding="0" cellspacing="0"><tr><td width="22%" height="29"><div align="right"><font color="#FF0000">*</font>用户代码:</div></td><td width="78%"><input name="userId" type="text" class="text1" id="userId"size="10" maxlength="10" onkeypress="userIdOnkeypress()"></td></tr><tr><td height="26"><div align="right"><font color="#FF0000">*</font>用户名称:</div></td><td><input name="userName" type="text" class="text1" id="userName"size="20" maxlength="20"></td></tr><tr><td height="26"><div align="right"><font color="#FF0000">*</font>密码:</div></td><td><label><input name="password" type="password" class="text1"id="password" size="20" maxlength="20"></label></td></tr><tr><td height="26"><div align="right">联系电话:</div></td><td><input name="contactTel" type="text" class="text1"id="contactTel" size="20" maxlength="20"></td></tr><tr><td height="26"><div align="right">email:</div></td><td><input name="email" type="text" class="text1" id="email"size="20" maxlength="20"></td></tr></table><hr width="97%" align="center" size=0><div align="center"><input name="btnAdd" class="button1" type="button" id="btnAdd"value="添加" onClick="addUser()"><input name="btnBack" class="button1" type="button" id="btnBack"value="返回" onClick="goBack()" /></div></div></form></body></html>
原文地址:http://blog.csdn.net/u010927139/article/details/46287577