员工管理系统

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/CSDN_GIA/article/details/54645412

员工管理系统

功能介绍

l  登录

l  条件查询员工

l  查看员工明细

l  下载简历

l  添加员工(上传简历)

l  修改员工

l  删除员工


环境搭建

导入基础项目

基础项目中已经包含了静态页面,以及js、css等等;

 导包

l  struts2

l  c3p0

l  mysql

l  dbutils

l  beanutils

 

 建包

l  cn.itcast.user.domain

l  cn.itcast.user.dao

l  cn.itcast.user.service

l  cn.itcast.user.web.action


 主页

让主页转发到/login/login.jsp


1、创建数据库

CREATE DATABASE empmng;

#创建用户,指定为只能本地访问,不能远程访问
create user empmng@localhost identified by '123';
#授权
grant all on empmng.* to empmng@localhost;

CREATE TABLE S_User(
	uid CHAR(32) PRIMARY KEY, 
	username VARCHAR(50),
	loginname VARCHAR(50),
	loginpass VARCHAR(50),
	gender VARCHAR(10),
	birthday VARCHAR(50),
	education VARCHAR(20),
	cellphone VARCHAR(50),
	hobby VARCHAR(20),
	filepath VARCHAR(500),
	filename VARCHAR(100),
	remark VARCHAR(500)
);


c3p0-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<c3p0-config>
  <default-config>
    <property name="driverClass">com.mysql.jdbc.Driver</property>
    <property name="jdbcUrl">jdbc:mysql:///struts2-javaee16</property>
    <property name="user">root</property>
    <property name="password">1234</property>
    <property name="initialPoolSize">3</property>
    <property name="maxIdleTime">30</property>
    <property name="maxPoolSize">5</property>
    <property name="minPoolSize">3</property>
  </default-config>
</c3p0-config>


2、创建User类

对应t_user表来创建User类。


3、创建javabean

User:
package cn.itcast.user.domain;

import java.io.File;

public class User {
	private String uid;
	private String username;
	private String loginname;
	private String loginpass;
	private String gender;
	private String birthday;
	private String education;
	private String cellphone;
	private String hobby;
	private String filepath;
	private String filename;
	private String remark;
//upload 字段在数据库中并没有列与之对应
// 接受表单提交的是否有简历的参数
	private String upload;
	
	
	


	public String getUpload() {
		return upload;
	}

	public void setUpload(String upload) {
		this.upload = upload;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getLoginname() {
		return loginname;
	}

	public void setLoginname(String loginname) {
		this.loginname = loginname;
	}

	public String getLoginpass() {
		return loginpass;
	}

	public void setLoginpass(String loginpass) {
		this.loginpass = loginpass;
	}

	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getEducation() {
		return education;
	}

	public void setEducation(String education) {
		this.education = education;
	}

	public String getCellphone() {
		return cellphone;
	}

	public void setCellphone(String cellphone) {
		this.cellphone = cellphone;
	}

	public String getHobby() {
		return hobby;
	}

	public void setHobby(String hobby) {
		this.hobby = hobby;
	}

	public String getFilepath() {
		return filepath;
	}

	public void setFilepath(String filepath) {
		this.filepath = filepath;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Override
	public String toString() {
		return "User [uid=" + uid + ", username=" + username + ", loginname="
				+ loginname + ", loginpass=" + loginpass + ", gender=" + gender
				+ ", birthday=" + birthday + ", education=" + education
				+ ", cellphone=" + cellphone + ", hobby=" + hobby
				+ ", filepath=" + filepath + ", filename=" + filename
				+ ", remark=" + remark + "]";
	}

}


用户登录:


用户列表:


查看用户:


保存用户:

dao:
UserDao:
package cn.itcast.user.dao;

import java.util.List;

import cn.itcast.user.domain.User;

public interface UserDao {
	//根据登录名称获得用户对象
	User  getUserByLoginName(String loginName);
	// 根据查询条件获得用户列表
	List<User> getUserByCondition(User u);
	//保存用户对象
	void  saveUser(User u);
	//根据userid 获得user对象
	User getUserByUid(String id);
}



UserDaoImpl:
package cn.itcast.user.dao;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import cn.itcast.user.domain.User;

public class UserDaoImpl implements UserDao {
	private static QueryRunner qr = new QueryRunner(new ComboPooledDataSource());
	
	public User getUserByLoginName(String loginName) {
		//1 书写sql语句
		String sql = " select * from tab_user where loginname = ? ";
		//2 调用runner的 query方法
		try {
			User u  = qr.query(sql, new  BeanHandler<User>(User.class), loginName);
			//3 返回
			return u;
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException("查询用户失败!");
		}
	}

	public List<User> getUserByCondition(User u) {
		String sql = " select * from tab_user  where 1=1";
		//准备放置参数的集合
		List<Object> params = new ArrayList<Object>();
		//判断 拼装查询语句,和添加参数
		//用户名
		if(u.getUsername() != null && !"".equals(u.getUsername().trim())){
			sql = sql + " and  username=? ";
			params.add(u.getUsername());
		}
		//根据学历
		if(u.getEducation() != null && !"".equals(u.getEducation().trim())){
			sql = sql + " and  education=? ";
			params.add(u.getEducation());
		}
		//根据性别
		if(u.getGender() != null && !"".equals(u.getGender().trim())){
			sql = sql + " and  gender=? ";
			params.add(u.getGender());
		}
		//根据是否上传简历
		if(u.getUpload() != null && !"".equals(u.getUpload().trim())){
				if(u.getUpload().equals("1")){//用户要找有简历的
					sql = sql + " and  filepath is not null ";
				}
				if(u.getUpload().equals("2")){//用户要找没有简历的
					sql = sql + " and  filepath is  null ";
				}
		}
		
		try {
			System.out.println(sql);
			System.out.println(params);
			List<User> list = qr.query(sql, new BeanListHandler<User>(User.class), params.toArray());
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException("查询用户列表失败!");
		}
		
		
	}

	public void saveUser(User u) {
		String sql =	
				" INSERT INTO `tab_user`                 "+
				" VALUES                                 "+
				"   (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ";
		
		try {
			int result = qr.update(sql, u.getUid(),u.getUsername(),
					u.getLoginname(),u.getLoginpass(),
					u.getGender(),u.getBirthday(),u.getEducation(),
					u.getCellphone(),u.getHobby(),u.getFilepath(),
					u.getFilename(),u.getRemark());
			if(result!=1){
				throw new RuntimeException("保存用户失败!");
			}
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException("保存用户失败!");
		}
		 
	}

	public User getUserByUid(String id) {
		//1 书写sql语句
		String sql = " select * from tab_user where uid = ? ";
		//2 调用runner的 query方法
		try {
			User u  = qr.query(sql, new  BeanHandler<User>(User.class), id);
			//3 返回
			return u;
		} catch (SQLException e) {
			e.printStackTrace();
			throw new RuntimeException("查询用户失败!");
		}
	}

}


action:

UserAction:

package cn.itcast.user.web.action;

import java.io.File;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import javax.servlet.ServletContext;

import org.apache.struts2.ServletActionContext;

import cn.itcast.user.dao.UserDao;
import cn.itcast.user.dao.UserDaoImpl;
import cn.itcast.user.domain.User;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.util.ValueStack;
import com.sun.xml.internal.ws.util.ReadOnlyPropertyException;

public class UserAction extends ActionSupport implements ModelDriven<User> {
	private UserDao ud = new UserDaoImpl();
	private User u = new User();
	
	
	//处理用户登录请求
	public String login(){
		//1 校验
		//2 根据登录名调用Dao,获得用户对象
		User user  = ud.getUserByLoginName(u.getLoginname());
				//没有获得=> 添加错误消息,提示用户名不存在
		if(user == null){
				addActionError("用户名不存在!");
				return "login";
		}
		//3 比对密码 
		if(!user.getLoginpass().equals(u.getLoginpass())){
			//比对失败=>添加错误,提示密码不正确
				addActionError("密码不正确!");
				return "login";
		}
		//4 将User对象放入session域作为登录标识
		Map<String, Object> sessionScope = ActionContext.getContext().getSession();
		sessionScope.put("user", user);
		//5 重定向到成功页面
		return "home";
		
	}
	//-----------------------------------------------------------------------------------------
	//查询用户列表
	public String list(){
		// 1 调用Dao的查询列表方法
		List<User> list = ud.getUserByCondition(u);
		//2 将列表放入request域
		Map<String,Object> requestScope = (Map<String, Object>) ActionContext.getContext()
																			.get("request");
		requestScope.put("list", list);
		//3 转发到list页面
		return "list";
		
	}
	//---------------------------------------------------------------
	//查看用户详情
	public String view(){
		//1 查询用户根据id
		User user = ud.getUserByUid(u.getUid());
		
		//2 将user对象放入值栈栈顶
		ValueStack vs = ActionContext.getContext().getValueStack();
		
		vs.push(user);
		//3转发到查看页面
		return "view";
		
		/*//2放入request域
		//3转发
*/		
	}
	//------------------------------------------------------------------------
	private String filePath;
	private String fileName ;
	public String download(){
		//1 根据id查找用户
		User user = ud.getUserByUid(u.getUid());
		//2 拿到用户的文件路径,文件名称
		filePath = user.getFilepath();
		fileName = user.getFilename();
		//3 返回结果
		
		return "download";
		
	}
	//filePath => /upload/23b798f5-0fc9-4add-9af9-fe8581a458ae
	public InputStream getDoc(){
		//1 获得servletcontext对象
		ServletContext sc = ServletActionContext.getServletContext();
		//2根据路径获得流
		return sc.getResourceAsStream(filePath);
		
	}
	public String getFileName(){
	try {
		return URLEncoder.encode(fileName, "utf-8");
	} catch (UnsupportedEncodingException e) {
		e.printStackTrace();
		throw new RuntimeException("不可楞!");
	}
	}
	//----------------------------------------------------------------------------------------
	private File upload2;
	
	private String upload2FileName;
	
	
	
	public String getUpload2FileName() {
		return upload2FileName;
	}
	public void setUpload2FileName(String upload2FileName) {
		this.upload2FileName = upload2FileName;
	}
	public File getUpload2() {
		return upload2;
	}
	public void setUpload2(File upload2) {
		this.upload2 = upload2;
	}
	public String add(){
		String uuid = UUID.randomUUID().toString();
		if(upload2 != null){
			// 1 上传的文件转存
				//1> 找到upload文件夹 绝对路径
			String dirPath = ServletActionContext.getServletContext().getRealPath("/upload");
				//2>生成 文件名称(uuid)
				//3> 转存
			File targetFile = new File(dirPath+"/"+uuid);
			
			upload2.renameTo(targetFile);
			
			// 2 将转存的路径 以及 文件的原始名称封装到User对象
			u.setFilepath("/upload/"+uuid);
			u.setFilename(upload2FileName);
		}
		// 3 使用随机字符串设置user的id
		u.setUid(uuid);
		// 4 调用dao保存user
		ud.saveUser(u);
		// 5 重定向到用户列表
		return "rlist";
	}
	
	//-----------------------------------------------------------------------------------------
	//专门校验login的
	public void validateLogin(){
		//数据校验
		if(u.getLoginname() == null || u.getLoginname().trim().equals("")){
			addFieldError("loginname", "用户名不能为空!");
		}
		
		if(u.getLoginpass() == null || u.getLoginpass().trim().equals("")){
			addFieldError("loginpass", "密码不能为空!");
		}
	}
	
	public User getModel() {
		return u;
	}
	
}


interceptor:
package cn.itcast.user.web.interceptor;

import java.util.Map;

import cn.itcast.user.domain.User;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class LoginInterceptor extends MethodFilterInterceptor {

	@Override
	//凡是进入拦截器,都需要有登录状态才能放行
	protected String doIntercept(ActionInvocation invocation) throws Exception {
			//1 获得session
			Map<String,Object> sessionScope = ActionContext.getContext().getSession();
			//2 从session找出User对象
			User u = (User) sessionScope.get("user");
			//3 判断User对象是否存在
			if(u==null){
				//不存在=>没有登录=>转发登录页面
				return "login";
			}
			
				//存在=>登录了=>放行
		return invocation.invoke();
	}

}


struts.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
	<constant name="struts.devMode" value="true" />
	<constant name="struts.action.extension" value="do" />
	
    <package name="user" namespace="/" extends="struts-default">
    	<interceptors>
    		<!-- 配置自己的拦截器 -->
    		<interceptor name="login" class="cn.itcast.user.web.interceptor.LoginInterceptor"></interceptor>
    		<!-- 配置自己的拦截器栈 -->
    		<interceptor-stack name="myDefaultStack">
    			<!-- 加入自己的拦截器 -->
    			<interceptor-ref name="login">
    			<!-- login方法不拦截,其他都拦截 -->
    				<param name="excludeMethods">login</param>
    			</interceptor-ref>
    			<!-- 加入默认18个拦截器的拦截器栈 -->
    			<interceptor-ref name="defaultStack"></interceptor-ref>
    		</interceptor-stack>
    	</interceptors>
    	<!-- 指定当前包,默认拦截器栈为myDefaultStack -->
    	<default-interceptor-ref name="myDefaultStack"></default-interceptor-ref>
    	<!-- 全局错误配置 -->
    	<global-exception-mappings>
    		<!-- 如果出现java.lang.RuntimeException的异常,那么转发到error对应的页面 -->
    			<exception-mapping result="error" exception="java.lang.RuntimeException"></exception-mapping>
    	</global-exception-mappings>
    	
    	<action name="UserAction_*" class="cn.itcast.user.web.action.UserAction" method="{1}" >
    			<result name="error" >/user/error1.jsp</result>
    			<result name="login" >/login/login.jsp</result>
    			<result name="home" type="redirect"  >/login/home.jsp</result>
    			<result name="list"  >/user/list.jsp</result>
    			<result name="view"  >/user/view.jsp</result>
    			<result name="rlist" type="redirectAction">
		             <param name="actionName">UserAction_list</param>
		             <param name="namespace">/</param>
         		</result>
    			<result name="download" type="stream" >
    					 <param name="contentType">application/msword</param>
				   		 <param name="inputName">doc</param>
				  		 <param name="contentDisposition">attachment;filename="${fileName}"</param>
				  		 <param name="bufferSize">1024</param>
    			</result>
    			
    			<result name="input" >/login/login.jsp</result>
    			
    	</action>
    </package>
</struts>


jsf:
importTag.jsf:
<%@ taglib prefix="s" uri="/struts-tags" %>

login:
bottom.jsp
<body MS_POSITIONING="GridLayout">
		<table width="100%" border="0" cellspacing="0" cellpadding="10" height="64">
			<tr>
				<td align="center" width="100%" style= valign="top" background="<c:url value='/images/bt_02.jpg'/>">传智播客Struts2练习       <br>
				<font class="font12">
				<a class="a03" target="_blank" href="mailto:sarft@chinasarft.gov.cn">
				<font color="#000000"><br></font></a></font></td>
			</tr>
		</table>
	</body>



home.jsp
<html>
	<head>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style>
		body
		{
			SCROLLBAR-ARROW-COLOR: #ffffff;  SCROLLBAR-BASE-COLOR: #dee3f7;
		}
    </style>
  </head>
  
<frameset rows="103,*,43" frameborder=0 border="0" framespacing="0">
  <frame src="<c:url value='/login/top.jsp'/>" name="topFrame" scrolling="NO" noresize>
  <frameset cols="159,*" frameborder="0" border="0" framespacing="0">
		<frame src="<c:url value='/login/left.jsp'/>" name="leftFrame" noresize scrolling="YES">
		<frame src="<c:url value='/login/welcome.jsp'/>" name="mainFrame">
  </frameset>
  <frame src="<c:url value='/login/bottom.jsp'/>" name="bottomFrame" scrolling="NO"  noresize>
</frameset>
</html>



left.jsp
<body>
<table width="100" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="12"></td>
  </tr>
</table>
<table width="100%" border="0">
  <tr>
    <td>
<div class="dtree">

	<a href="javascript: d.openAll();">展开所有</a> | <a href="javascript: d.closeAll();">关闭所有</a>
	<link rel="StyleSheet" href="<c:url value='/css/dtree.css'/>" type="text/css" />
	<script type="text/javascript" src="<c:url value='/js/dtree.js'/>"></script>
	<script type="text/javascript">
		d = new dTree('d');
		d.add(0,-1,'系统菜单树');
		d.add(2,0,'员工管理','<c:url value="/login/welcome.jsp"/>','','mainFrame');
		//子目录添加
		d.add(3,2,'用户管理','<s:url action="UserAction_list" namespace="/" ></s:url>','','mainFrame');

		
		document.write(d);
	</script>
</div>	</td>
  </tr>
  
</table>
</body>



login.jsp
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
function ini(){
   document.form1.loginname.focus();
}
</script>

<html>
	<head>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title></title>
		<link href="<c:url value='/css/Style.css'/>" rel="stylesheet" type="text/css">
	</head>

	<body onload="ini()">
		<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td align="center">
					<table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
						<tr>
							<td bgcolor="#FFFFFF">
								<table width="452" height="290" border="0" cellpadding="0" cellspacing="0">
									<tr>
										<td height="74">
											<img src="<c:url value='/images/logintitle.gif'/>">
										</td>
									</tr>
									<tr>
										<td align="center" valign="bottom" background="<c:url value='/images/loginbg.gif'/>">
											<s:form id="loginAction_home" name="form1" action="UserAction_login" namespace="/" target="_parent" method="post" theme="simple" >
												<table border="0" align="center" cellpadding="2" cellspacing="0">
													<tr align="center">
														<td height="30" colspan="2" style="border-bottom: 1px dotted #cccccc">
															<strong style="font-size: 14px;">请登录</strong>
														</td>
													</tr>
													<tr>
														<td height="30" nowrap>
															<font color="000F60"><strong>用户名:</strong> </font>
														</td>
														<td>
															<s:textfield name="loginname" id="loginname" cssClass="text" cssStyle="width: 160px;" ></s:textfield>
															<font color="red"><s:fielderror fieldName="loginname" ></s:fielderror></font>
														</td>
													</tr>
													<tr>
														<td height="30" nowrap>
															<strong><font color="000F60">密码: </font> </strong>
														</td>
														<td>
															<s:password name="loginpass" id="loginpass" cssClass="text" cssStyle="width: 160px;" ></s:password>
															<font color="red"><s:fielderror fieldName="loginpass" ></s:fielderror></font>
														</td>
													</tr>
													<tr>
														<td height="30" nowrap colspan="2">
															<strong><font color="red"></font> </strong>
														</td>
													</tr>
													<tr>
														<td height="30">
														</td>
														<td>
															<input type="submit" name="submit" value="登录" class="buttoninput"/>

															<input type="reset" name="reset" value="取消" class="buttoninput"/>

														</td>
													</tr>
												</table>
											</s:form>
											<!-- 在这里显示各种错误信息 -->
												<font color="red"><s:actionerror/></font>
												
												
				

											<table width="100%" border="0" cellspacing="0" cellpadding="0">
												<tr>
													<td height="30" align="center">
													</td>
												</tr>
												<tr>
													<td height="23" align="center"></td>
												</tr>
											</table>
										</td>
									</tr>

								</table>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>



top.jsp
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
	<head>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<style type="text/css">
BODY {
	MARGIN: 0px;
	BACKGROUND-COLOR: #ffffff
}

BODY {
	FONT-SIZE: 12px;
	COLOR: #000000
}

TD {
	FONT-SIZE: 12px;
	COLOR: #000000
}

TH {
	FONT-SIZE: 12px;
	COLOR: #000000
}
</style>
		<link href="<c:url value='/css/Style.css'/>" rel="stylesheet" type="text/css">
	</HEAD>
	<body>
		<table width="100%" height="70%"  border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td>
					<img width="100%" src="<c:url value='/images/top_01.jpg'/>">
				</td>

				<td width="100%" background="<c:url value='/images/top_100.jpg'/>">
				</td>
			</tr>
		</table>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td height="30" valign="bottom" background="<c:url value='/images/mis_01.jpg'/>">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td width="85%" align="left">
							      
								<font color="#000000"> <script language="JavaScript">
<!--
tmpDate = new Date();
date = tmpDate.getDate();
month= tmpDate.getMonth() + 1 ;
year= tmpDate.getFullYear();
document.write(year);
document.write("年");
document.write(month);
document.write("月");
document.write(date);
document.write("日 ");

myArray=new Array(6);
myArray[0]="星期日"
myArray[1]="星期一"
myArray[2]="星期二"
myArray[3]="星期三"
myArray[4]="星期四"
myArray[5]="星期五"
myArray[6]="星期六"
weekday=tmpDate.getDay();
if (weekday==0 | weekday==6)
{
document.write(myArray[weekday])
}
else
{document.write(myArray[weekday])
};
// -->
									</script> </font>
							</td>
							<td width="15%">
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td width="16"
											background="<c:url value='/images/mis_05b.jpg'/>">
											<img
												src="<c:url value='/images/mis_05a.jpg'/>"
												width="6" height="18">
										</td>
										<td width="155" valign="bottom"
											background="<c:url value='/images/mis_05b.jpg'/>">
											用户名:
											<font color="blue">超级管理员</font>
										</td>
										<td width="10" align="right"
											background="<c:url value='/images/mis_05b.jpg'/>">
											<img src="<c:url value='/images/mis_05c.jpg'/>" width="6" height="18">
										</td>
									</tr>
								</table>
							</td>
							<td align="right" width="5%">
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</HTML>



welcome.jsp
<style type="text/css">
<!--
body {
	background-color: #FFFFFF;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
body,td,th {
	color: #000000;
}
-->
    </style>
<style>
BODY {SCROLLBAR-FACE-COLOR: #cccccc; SCROLLBAR-HIGHLIGHT-COLOR: #ffffFF; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #cccccc; SCROLLBAR-ARROW-COLOR:  #ffffff; SCROLLBAR-TRACK-COLOR: #ffffFF; SCROLLBAR-DARKSHADOW-COLOR: #cccccc; }
</style>
</head>

<body>

<form name="Form1" method="post" action="name.aspx" id="Form1">

	<table width="100%" border="0" height="88" border="1" background="<c:url value='/images/back1.JPG'/>">
		<tr>
			<td colspan=3 class="ta_01" align="center" bgcolor="#afd1f3"><strong>系统首页</strong></td>
		</tr>

		<tr>
			<td width="65%" height="84" align="center" valign="top" >
				<span class="Style1">登录成功!</span>
			</td>
		</tr>
		<tr><td height=2></td></tr>
	
	</table>

	</form>

</body>


User:
add.jsp:
<script type="text/javascript">
		$(document).ready(function(){
			//使用class属性处理  'yy-mm-dd' 设置格式"yyyy/mm/dd"
			$('#birthday').datepick({dateFormat: 'yy-mm-dd'}); 
		});
	</script>
	<body>
		<s:form id="userAction_save_do" name="Form1" action="UserAction_add" namespace="/" theme="simple" method="post" enctype="multipart/form-data">
			 
			<table cellSpacing="1" cellPadding="5" width="100%" align="center" bgColor="#eeeeee" style="border: 1px solid #8ba7e3" border="0">
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3" colSpan="4"
						height="26">
						<strong><STRONG>添加用户</STRONG>
						</strong>
					</td>
				</tr>

				<tr>
					<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
						登录名:
					</td>
					<td class="ta_01" bgColor="#ffffff" colspan="3">
						<s:textfield name="loginname"  id="userAction_save_do_loginname" cssClass="bg" ></s:textfield>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						 密码:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:password  name="loginpass"  id="loginpass"></s:password>
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						用户姓名:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:textfield name="username"  id="userAction_save_do_username" cssClass="bg" ></s:textfield>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						性别:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:radio list="{'男','女'}" name="gender" id="gender男"  ></s:radio>
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						学历:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:select list="{'本科','专科','高中'}" name="education" id="education" headerKey="" headerValue="--请选择--" ></s:select>

					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						出生日期:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:textfield  name="birthday" size="20" value="" readonly="readonly" id="birthday" ></s:textfield>
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						电话:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:textfield name="cellphone" value="" id="cellphone" ></s:textfield>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						兴趣爱好:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
					<s:checkboxlist list="{'看电影','旅游','健身','购物','睡觉'}" name="hobby"  id="hobby-1" ></s:checkboxlist>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						简历资料:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
						<s:file  name="upload2" size="30"  id="userAction_save_do_upload" ></s:file>
					</td>
				</tr>
				<TR>
					<TD class="ta_01" align="center" bgColor="#f5fafe">
						备注:
					</TD>
					<TD class="ta_01" bgColor="#ffffff" colSpan="3">
					<s:textarea name="remark" cols="30" rows="3" id="userAction_save_do_remark" cssStyle="WIDTH: 96%" ></s:textarea>
					</TD>
				</TR>
				<TR>
					<td align="center" colSpan="4" class="sep1">
						<img src="<c:url value='/images/shim.gif'/>">
					</td>
				</TR>


				<tr>
					<td class="ta_01" style="WIDTH: 100%" align="center"
						bgColor="#f5fafe" colSpan="4">
						<button type="submit" id="userAction_save_do_submit" name="submit" value="确定" class="button_ok">
							确定
						</button>

						<FONT face="宋体">       </FONT>
						<button type="reset" value="重置" class="button_cancel">重置</button>

						<FONT face="宋体">       </FONT>
						<INPUT class="button_ok" type="button" onclick="history.go(-1)" value="返回"/>
						<span id="Label1"></span>
					</td>
				</tr>
			</table>
		</s:form>
	</body>


edit.jsp:
<!-- 日期插件,使用jquery -->
		<script type="text/javascript" src="<c:url value='/jquery/jquery-1.4.2.js'/>"></script>
		<link rel="stylesheet" href="<c:url value='/jquery/jquery.datepick.css'/>" type="text/css">
		<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/jquery/jquery.datepick-zh-CN.js'/>"></script>
	</HEAD>
	<script type="text/javascript">
		$(document).ready(function(){
			//使用class属性处理  'yy-mm-dd' 设置格式"yyyy/mm/dd"
			$('#birthday').datepick({dateFormat: 'yy-mm-dd'}); 
		});
	</script>
	<body>
		<form id="userAction_save_do" name="Form1" action="<c:url value='/user/list.jsp'/>" method="post" enctype="multipart/form-data">
			 
			<table cellSpacing="1" cellPadding="5" width="100%" align="center" bgColor="#eeeeee" style="border: 1px solid #8ba7e3" border="0">
				<input type="hidden" name="userID" value="17" id="userID"/>
				<input type="hidden" name="path" value="D:\apache-tomcat-6.0.18\webapps\itcastStrutsProject\upload/2012/03/29/费用报销单模板.doc" id="path"/>
				<input type="hidden" name="filename" value="费用报销单模板.doc" id="filename"/>
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3" colSpan="4"
						height="26">
						<strong><STRONG>编辑用户</STRONG>
						</strong>
					</td>
				</tr>

				<tr>
					<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
						登录名:
					</td>
					<td class="ta_01" bgColor="#ffffff" colspan="3">
						<input type="text" name="loginname" value="caocao" id="userAction_save_do_loginname" class="bg"/>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						 密码:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<input type="password" name="loginpass" value="123" id="loginpass"/>
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						用户姓名:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<input type="text" name="username" value="曹操" id="userAction_save_do_username" class="bg"/>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						性别:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<input type="radio" name="gender" id="gender男" value="男"/><label for="gender男">男</label>
						<input type="radio" name="gender" id="gender女" checked="checked" value="女"/><label for="gender女">女</label>

					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						学历:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						
						
						<select name="education" id="education">
						    <option value="">--选择学历--</option>
						    <option value="博士">博士</option>
						    <option value="硕士">硕士</option>
						    <option value="研究生" selected="selected">研究生</option>
						    <option value="本科">本科</option>
						    <option value="专科">专科</option>
						    <option value="高中">高中</option>
						
						
						</select>

					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						出生日期:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<input type="text" name="birthday" size="20" value="2012-03-01" readonly="readonly" id="birthday"/>
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						电话:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<input type="text" name="cellphone" value="12312121" id="cellphone"/>
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						兴趣爱好:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
						 <input type="checkbox" name="hobby" value="看电影" id="hobby-1" checked="checked"/>
						<label for="hobby-1" class="checkboxLabel">看电影</label>
						<input type="checkbox" name="hobby" value="旅游" id="hobby-2" checked="checked"/>
						<label for="hobby-2" class="checkboxLabel">旅游</label>
						<input type="checkbox" name="hobby" value="健身" id="hobby-3"/>
						<label for="hobby-3" class="checkboxLabel">健身</label>
						<input type="checkbox" name="hobby" value="购物" id="hobby-4"/>
						<label for="hobby-4" class="checkboxLabel">购物</label>
						<input type="checkbox" name="hobby" value="睡觉" id="hobby-5"/>
						<label for="hobby-5" class="checkboxLabel">睡觉</label>
						<input type="hidden" id="__multiselect_userAction_save_do_hobby" name="__multiselect_hobby" value="" /> 
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						简历资料:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
						<input type="file" name="upload" size="30" value="" id="userAction_save_do_upload"/>
					</td>
				</tr>
				<TR>
					<TD class="ta_01" align="center" bgColor="#f5fafe">
						备注:
					</TD>
					<TD class="ta_01" bgColor="#ffffff" colSpan="3">
						<textarea name="remark" cols="30" rows="3" id="userAction_save_do_remark" style="WIDTH: 96%">的</textarea>
					</TD>
				</TR>
				<TR>
					<td align="center" colSpan="4" class="sep1">
						<img src="<c:url value='/images/shim.gif'/>">
					</td>
				</TR>
				<tr>
					<td class="ta_01" style="WIDTH: 100%" align="center"
						bgColor="#f5fafe" colSpan="4">
						<button type="submit" id="userAction_save_do_submit" name="submit" value="确定" class="button_ok">
							确定
						</button>

						<FONT face="宋体">       </FONT>
						<button type="reset" value="重置" class="button_cancel">重置</button>

						<FONT face="宋体">       </FONT>
						<INPUT class="button_ok" type="button" onclick="history.go(-1)" value="返回"/>
						<span id="Label1"></span>
					</td>
				</tr>
			</table>
		</form>




	</body>



error.jsp:
<!--
.style1 {
	color: #FF0000;
	font-size: 18px;
}
-->
</style>
	</head>
	<body>
		<p>
			 
		</p>
		<table width="100%" border="0">
			<tr>
				<th width="18%" height="261" scope="col">
					 
				</th>

				<th width="53%" scope="col">
					<table width="453" height="220" border="0" cellpadding="0"
						cellspacing="0">

						<tr>
							<td height="220" align="center" valign="middle"
								background="<c:url vlaue='/images/loginbg.gif'/>">
								<p class="style1">
									<font color="red">上传附件错误</font>
								</p>
								<p>
									
								</p>
							</td>
						</tr>
						<tr>
							<td height="220" align="center" valign="middle">
								<FONT face="宋体">       </FONT>
								<INPUT class="button_ok" type="button" onclick="history.go(-1)" value="返回"/>
							</td>
						</tr>
					</table>
				</th>
				<th width="29%" scope="col">
					 
				</th>
			</tr>
		</table>
		<p>
			 
		</p>
	</body>



error1.jsp:
<!--
body {
	background-color: #FFFFFF;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
body,td,th {
	color: #000000;
}
-->
    </style>
<style>
BODY {SCROLLBAR-FACE-COLOR: #cccccc; SCROLLBAR-HIGHLIGHT-COLOR: #ffffFF; SCROLLBAR-SHADOW-COLOR: #ffffff; SCROLLBAR-3DLIGHT-COLOR: #cccccc; SCROLLBAR-ARROW-COLOR:  #ffffff; SCROLLBAR-TRACK-COLOR: #ffffFF; SCROLLBAR-DARKSHADOW-COLOR: #cccccc; }
</style>
</head>

<body>

<form name="Form1" method="post" action="name.aspx" id="Form1">

	<table width="100%" border="0" height="88" border="1" background="<c:url value='/images/back1.JPG'/>">
		<tr>
			<td colspan=3 class="ta_01" align="center" bgcolor="#afd1f3"><strong>出错啦!</strong></td>
		</tr>

		<tr>
			<td width="65%" height="84" align="center" valign="top" >
				<span class="Style1">
					<font color="red"><s:property value="exception.message" /></font>
				</span>
			</td>
		</tr>
		<tr><td height=2></td></tr>
	
	</table>

	</form>

</body>



list.jsp:
<HTML>
	<HEAD>
		<meta http-equiv="Content-Language" content="zh-cn">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="<c:url value='/css/Style.css'/>" rel="stylesheet" type="text/css" />
		<script language="javascript" src="<c:url value='/js/public.js'/>"></script>
		<script type="text/javascript">
			function addUser(){
				window.location.href = "<c:url value='/user/add.jsp'/>";
			}
		</script>
	</HEAD>
	<body>
		<br>
		<s:form id="Form1" name="Form1" action="UserAction_list" namespace="/" method="post" theme="simple" >
			<table cellSpacing="1" cellPadding="0" width="100%" align="center" bgColor="#f5fafe" border="0">
				<TBODY>
					<tr>
						<td class="ta_01" align="center" bgColor="#afd1f3">
							<strong>查 询 条 件</strong>
						</td>
					</tr>
					<tr>
						<td>
							<table cellpadding="0" cellspacing="0" border="0" width="100%">
								<tr>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										用户姓名
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<s:textfield name="username" size="15" id="Form1_username" cssClass="bg" ></s:textfield>
									</td>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										性别:
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<s:select list="{'男','女'}" name="gender" id="gender" headerKey="" headerValue="--请选择--" ></s:select>
									</td>
								</tr>
								<tr>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										学历:
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<s:select list="{'本科','专科','高中'}" name="education" id="education" headerKey="" headerValue="--请选择--" ></s:select>

									</td>
									<td height="22" align="center" bgColor="#f5fafe" class="ta_01">
										是否上传简历
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<s:select list="#{'1':'有','2':'无'}" name="upload" id="upload"
											 headerKey="" headerValue="--请选择--" ></s:select>

									</td>
								</tr>
								<tr>
									<td width="100" height="22" align="center" bgColor="#f5fafe"
										class="ta_01">
									</td>
									<td class="ta_01" bgColor="#ffffff">
										<font face="宋体" color="red">  </font>
									</td>
									<td align="right" bgColor="#ffffff" class="ta_01"><br><br></td>
									<td align="right" bgColor="#ffffff" class="ta_01">
										<button type="submit" id="search" name="search" value="查询" class="button_view">
查询
</button>

										     
										<input type="reset" name="reset" value="重置" class="button_view"/>

									</td>
								</tr>
							</table>
						</td>

					</tr>
					<tr>
						<td class="ta_01" align="center" bgColor="#afd1f3">
							<strong>用 户 列 表</strong>
						</TD>
					</tr>
					<tr>
						<td class="ta_01" align="right">
							<button type="button" id="add" name="add" value="添加" class="button_add" onclick="addUser()">
添加
</button>

						</td>
					</tr>
					<tr>
						<td class="ta_01" align="center" bgColor="#f5fafe">
							<table cellspacing="0" cellpadding="1" rules="all"
								bordercolor="gray" border="1" id="DataGrid1"
								style="BORDER-RIGHT: gray 1px solid; BORDER-TOP: gray 1px solid; BORDER-LEFT: gray 1px solid; WIDTH: 100%; WORD-BREAK: break-all; BORDER-BOTTOM: gray 1px solid; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: #f5fafe; WORD-WRAP: break-word">
								<tr
									style="FONT-WEIGHT: bold; FONT-SIZE: 12pt; HEIGHT: 25px; BACKGROUND-COLOR: #afd1f3">

									<td align="center" width="18%">
										登录名
									</td>
									<td align="center" width="17%">
										用户姓名
									</td>
									<td align="center" width="8%">
										性别
									</td>
									<td align="center" width="23%">
										联系电话
									</td>
									<td width="11%" align="center">
										学历
									</td>
									<td width="7%" align="center">
										编辑
									</td>
									<td width="7%" align="center">
										查看
									</td>
									<td width="7%" align="center">
										删除
									</td>
								</tr>
								
									<s:iterator value="#request.list" var="user" >
										<tr onmouseover="this.style.backgroundColor = 'white'"
											onmouseout="this.style.backgroundColor = '#F5FAFE';">
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="18%">
												<s:property value="loginname"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="17%">
												<s:property value="username"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="8%">
												<s:property value="gender"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center"
												width="23%">
												<s:property value="cellphone"/>
											</td>
											<td style="CURSOR: hand; HEIGHT: 22px" align="center">
												<s:property value="education"/>
											</td>
											<td align="center" style="HEIGHT: 22px">
												<a href="<c:url value='/user/edit.jsp?userID=15'/>">
													<img src="<c:url value='/images/i_edit.gif'/>" border="0" style="CURSOR: hand">
												</a>
											</td>
											<td align="center" style="HEIGHT: 22px">
															<s:url action="UserAction_view" namespace="/" var="viewUrl"  >
																<s:param name="uid" value="uid"></s:param>
															</s:url>
												<a href="<s:property  value="#viewUrl" />">
													<img src="<c:url value='/images/button_view.gif'/>" border="0" style="CURSOR: hand">
												</a>
											</td>
											<td align="center" style="HEIGHT: 22px">
												<a href="<c:url value='/user/list.jsp?userID=15'/>">
													<img src="<c:url value='/images/i_del.gif'/>" width="16" height="16" border="0" style="CURSOR: hand">
												</a>
											</td>
										</tr>
									</s:iterator>
							</table>
						</td>
					</tr>
				</TBODY>
			</table>
		</s:form>
	</body>



view.jsp:
<body>
		<form id="userAction_save_do" name="Form1" action="<c:url value='/user/userAction_save.do'/>" method="post" enctype="multipart/form-data">
			 
			<table cellSpacing="1" cellPadding="5" width="100%" align="center" bgColor="#eeeeee" style="border: 1px solid #8ba7e3" border="0">
				<tr>
					<td class="ta_01" align="center" bgColor="#afd1f3" colSpan="4"
						height="26">
						<strong><STRONG>查看用户</STRONG>
						</strong>
					</td>
				</tr>

				<tr>
					<td width="18%" align="center" bgColor="#f5fafe" class="ta_01">
						登录名:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="loginname" />
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						用户姓名:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="username" />
					</td>
				</tr>
				
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						性别:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="gender" />
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						学历:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="education" />
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						出生日期:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="birthday" />
					</td>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						电话:
					</td>
					<td class="ta_01" bgColor="#ffffff">
						<s:property value="cellphone" />
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						兴趣爱好:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
						 <s:property value="hobby" />
					</td>
				</tr>
				<tr>
					<td align="center" bgColor="#f5fafe" class="ta_01">
						简历资料:
					</td>
					<td class="ta_01" bgColor="#ffffff" colSpan="3">
						<a href="#" onclick="openWindow('user/userAction_download.do?userID=17','700','400')" class="cl_01">
						    <s:a action="UserAction_download" namespace="/"   >
						    <s:param name="uid"  value="uid" ></s:param>
						    <s:property value="filename" />
						    </s:a>
						</a>
					</td>
				</tr>
				<TR>
					<TD class="ta_01" align="center" bgColor="#f5fafe">
						备注:
					</TD>
					<TD class="ta_01" bgColor="#ffffff" colSpan="3">
						<s:property value="remark" />
					</TD>
				</TR>
				<TR>
					<td align="center" colSpan="4" class="sep1">
						<img src="<c:url value='/images/shim.gif'/>">
					</td>
				</TR>
				<TR>
					<td class="ta_01" style="WIDTH: 100%" align="right" bgColor="#f5fafe" colSpan="4">
						<FONT face="宋体">       </FONT>
						<INPUT class="button_ok" type="button" onclick="history.go(-1)" value="返回"/>
						<span id="Label1"></span>
					</td>
				</TR>
			</table>
		</form>
	</body>


index.jsp:
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<jsp:forward page="/login/login.jsp"></jsp:forward>







展开阅读全文

没有更多推荐了,返回首页