S2SH CRUD 整合

S2SH CRUD 整合

采用的框架 Struts2+Spring4+Hbiernate4.

 

目录结构

   

EmployeeAction:

  1 package com.xx.ssh.actions;
  2 
  3 import java.io.ByteArrayInputStream;
  4 import java.io.InputStream;
  5 import java.io.UnsupportedEncodingException;
  6 import java.util.Date;
  7 import java.util.Map;
  8 import org.apache.struts2.interceptor.RequestAware;
  9 import com.opensymphony.xwork2.ActionSupport;
 10 import com.opensymphony.xwork2.ModelDriven;
 11 import com.opensymphony.xwork2.Preparable;
 12 import com.xx.ssh.entities.Employee;
 13 import com.xx.ssh.service.DepartmentService;
 14 import com.xx.ssh.service.EmployeeService;
 15 
 16 public class EmployeeAction extends ActionSupport implements RequestAware,
 17         ModelDriven<Employee>, Preparable {
 18 
 19     private static final long serialVersionUID = 1L;
 20 
 21     private EmployeeService employssService;
 22 
 23     public void setEmployssService(EmployeeService employssService) {
 24         this.employssService = employssService;
 25     }
 26 
 27     private DepartmentService departmentService;
 28 
 29     public void setDepartmentService(DepartmentService departmentService) {
 30         this.departmentService = departmentService;
 31     }
 32 
 33     public String list() {
 34         request.put("employees", employssService.getAll());
 35         System.out.println("request: " + request.size());
 36         return "list";
 37     }
 38 
 39     private Integer id;
 40 
 41     public void setId(Integer id) {
 42         this.id = id;
 43     }
 44 
 45     private InputStream inputStream;
 46 
 47     public InputStream getInputStream() {
 48         return inputStream;
 49     }
 50     //回调函数。判断是否删除
 51     public String delete() {
 52         try {
 53             employssService.delete(id);
 54             inputStream = new ByteArrayInputStream("1".getBytes("UTF-8"));
 55         } catch (Exception e) {
 56             e.printStackTrace();
 57             try {
 58                 inputStream = new ByteArrayInputStream("0".getBytes("UTF-8"));
 59             } catch (UnsupportedEncodingException e1) {
 60                 e1.printStackTrace();
 61             }
 62         }
 63         return "ajax-success";
 64     }
 65 
 66     private String lastName;
 67 
 68     public void setLastName(String lastName) {
 69         this.lastName = lastName;
 70     }
 71     //回调函数。判断用户名是否存在。
 72     public String validateLastName() {
 73         try {
 74             if (employssService.lastNameIsValid(lastName)) {
 75 
 76                 inputStream = new ByteArrayInputStream("1".getBytes("utf-8"));
 77             } else {
 78 
 79                 inputStream = new ByteArrayInputStream("0".getBytes("utf-8"));
 80             }
 81         } catch (Exception e) {
 82 
 83         }
 84         return "ajax-success";
 85     }
 86 
 87     private Employee model;
 88 
 89     /*
 90      * 可以根椐ID来判断为save方法准备的model是new的还是数据库获取的。
 91      */
 92     public void prepareSave() {
 93         if (id == null) {
 94             model = new Employee();
 95         } else {
 96             model = employssService.get(id);
 97         }
 98     }
 99 
100     public String save() {
101 
102         if (id == null) {
103             model.setCreateTime(new Date());
104 
105         }
106         employssService.saveOrUpdate(model);
107         return SUCCESS;
108     }
109 
110     public String input() {
111         request.put("departments", departmentService.getAll());
112         return INPUT;
113     }
114 
115     public void prepareInput() {
116         if (id != null) {
117             model = employssService.get(id);
118         }
119 
120     }
121 
122     private Map<String, Object> request;
123 
124     @Override
125     public void setRequest(Map<String, Object> arg0) {
126         this.request = arg0;
127 
128     }
129 
130     @Override
131     public Employee getModel() {
132 
133         return model;
134     }
135 
136     @Override
137     public void prepare() throws Exception {
138 
139     }
140 
141 }
View Code

SSHDateConverter:自定义转换器

 1 package com.xx.ssh.converters;
 2 
 3 import java.text.DateFormat;
 4 import java.text.ParseException;
 5 import java.text.SimpleDateFormat;
 6 import java.util.Date;
 7 import java.util.Map;
 8 
 9 import org.apache.struts2.util.StrutsTypeConverter;
10 
11 public class SSHDateConverter extends StrutsTypeConverter {
12 
13     private DateFormat dateFormat;
14     {
15         dateFormat = new SimpleDateFormat("yyyy-MM-dd");
16     }
17     
18     @Override
19     public Object convertFromString(Map context, String[] values, Class toClass) {
20         if(toClass == Date.class){
21             try {
22                 return dateFormat.parse(values[0]);
23             } catch (ParseException e) {
24                 e.printStackTrace();
25             }
26         }
27         
28         return null;
29     }
30 
31     @Override
32     public String convertToString(Map context, Object o) {
33         if(o instanceof Date){
34             return dateFormat.format((Date)o);
35         }
36         return null;
37     }
38 
39 }
View Code

BaseDao:SessionFactory

 1 package com.xx.ssh.dao;
 2 
 3 import org.hibernate.Session;
 4 import org.hibernate.SessionFactory;
 5 
 6 public class BaseDao {
 7     private SessionFactory  sessionFactory;
 8 
 9     public void setSessionFactory(SessionFactory sessionFactory) {
10         this.sessionFactory = sessionFactory;
11     }
12     
13     public Session getSession() {
14         return  this.sessionFactory.getCurrentSession();
15     }
16 }
View Code

DepartmentDao:Dao层

 1 package com.xx.ssh.dao;
 2 
 3 import java.util.List;
 4 
 5 import com.xx.ssh.entities.Department;
 6 
 7 public class DepartmentDao extends BaseDao{
 8     public List<Department> getAll(){
 9         String hql="FROM Department";
10         return getSession().createQuery(hql).list();
11     }
12 }
View Code

EmployeeDao

 1 package com.xx.ssh.dao;
 2 
 3 import java.util.List;
 4 
 5 import org.hibernate.Query;
 6 import org.hibernate.Session;
 7 import org.hibernate.SessionFactory;
 8 
 9 import com.xx.ssh.entities.Employee;
10 
11 public class EmployeeDao extends BaseDao {
12     
13     
14     public void delete(Integer id){
15         String hql="delete from Employee e where e.id=? ";
16         getSession().createQuery(hql).setInteger(0,id).executeUpdate();
17     }
18 
19     public List<Employee> getAll(){
20         
21         String hql="from Employee e LEFT OUTER JOIN FETCH e.department";
22         return getSession().createQuery(hql).list();
23     }
24     public void saveOrUpdate(Employee employee){
25         getSession().saveOrUpdate(employee);
26     }
27     public Employee getEmployeeByLastName(String lastName){
28         
29         String hql="from Employee e where e.lastName=? ";
30         Query query = getSession().createQuery(hql).setString(0,lastName);
31         return (Employee)query.uniqueResult();
32     }
33     public Employee get(Integer id){
34         return (Employee) getSession().get(Employee.class,id);
35         
36     }
37 }
View Code

实体:Department

 1 package com.xx.ssh.entities;
 2 
 3 public class Department {
 4     private Integer id;
 5     private String departmentName;
 6 
 7     public Integer getId() {
 8         return id;
 9     }
10 
11     public void setId(Integer id) {
12         this.id = id;
13     }
14 
15     public String getDepartmentName() {
16         return departmentName;
17     }
18 
19     public void setDepartmentName(String departmentName) {
20         this.departmentName = departmentName;
21     }
22 }
View Code

实体:Employee

 1 package com.xx.ssh.entities;
 2 
 3 import java.util.Date;
 4 
 5 public class Employee {
 6     
 7     
 8     //
 9     private Integer id;
10     //不能被修改
11     private String lastName;
12     private String email;
13     //从前端传入的是string类型,所以需要注意转换。
14     private Date birth;
15     //不能被修改
16     private Date createTime;
17     //单向n-1的关联关系
18     private Department department;
19     
20     public Integer getId() {
21         return id;
22     }
23     public void setId(Integer id) {
24         this.id = id;
25     }
26     public String getLastName() {
27         return lastName;
28     }
29     public void setLastName(String lastName) {
30         this.lastName = lastName;
31     }
32     public String getEmail() {
33         return email;
34     }
35     public void setEmail(String email) {
36         this.email = email;
37     }
38     public Date getBirth() {
39         return birth;
40     }
41     public void setBirth(Date birth) {
42         this.birth = birth;
43     }
44     public Date getCreateTime() {
45         return createTime;
46     }
47     public void setCreateTime(Date createTime) {
48         this.createTime = createTime;
49     }
50     public Department getDepartment() {
51         return department;
52     }
53     public void setDepartment(Department department) {
54         this.department = department;
55     }
56     
57     @Override
58     public String toString() {
59         return "Employee [birth=" + birth + ", createTime=" + createTime
60                 + ", department.id=" + department + ", email=" + email + ", id="
61                 + id + ", lastName=" + lastName + "]";
62     }
63 }
View Code

表与类映射文件配置。

Department.hbm.xml

 1 <?xml version="1.0"?>
 2 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 3 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 4 <!-- Generated 2014-7-22 11:21:48 by Hibernate Tools 3.4.0.CR1 -->
 5 <hibernate-mapping>
 6     <class name="com.xx.ssh.entities.Department" table="SSH_DEPARTMENT">
 7         <id name="id" type="java.lang.Integer">
 8             <column name="ID" />
 9             <generator class="native" />
10         </id>
11       
12         <property name="departmentName" type="java.lang.String">
13             <column name="DEPARTMENT_NAME" />
14         </property>
15         
16     </class>
17 </hibernate-mapping>
View Code

Employee.hbm.xml

 1 <?xml version="1.0"?>
 2 <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 3 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 4 <!-- Generated 2014-7-22 11:21:48 by Hibernate Tools 3.4.0.CR1 -->
 5 <hibernate-mapping>
 6     <class name="com.xx.ssh.entities.Employee" table="SSH_EMPLOYEE">
 7         
 8         <id name="id" type="java.lang.Integer">
 9             <column name="ID" />
10             <generator class="native" />
11         </id>
12         
13         <property name="lastName" type="java.lang.String">
14             <column name="LAST_NAME" />
15         </property>
16         
17         <property name="email" type="java.lang.String">
18             <column name="EMAIL" />
19         </property>
20         
21         <property name="birth" type="java.util.Date">
22             <column name="BIRTH" />
23         </property>
24         
25         <property name="createTime" type="java.util.Date">
26             <column name="CREATE_TIME" />
27         </property>
28         
29         <!-- 映射单向 n-1 的关联关系 -->
30         <many-to-one name="department" class="com.xx.ssh.entities.Department" lazy="false">
31             <column name="DEPARTMENT_ID" />
32         </many-to-one>
33         
34     </class>
35 </hibernate-mapping>
View Code

Service层:Department

 1 package com.xx.ssh.service;
 2 
 3 import java.util.List;
 4 
 5 import com.xx.ssh.dao.DepartmentDao;
 6 import com.xx.ssh.entities.Department;
 7 
 8 public class DepartmentService {
 9     private DepartmentDao departmentDao;
10     
11     public void setDepartmentDao(DepartmentDao departmentDao){
12         this.departmentDao=departmentDao;
13     }
14     public List<Department>getAll(){
15         return departmentDao.getAll();
16     }
17     
18 }
View Code

Service层:Employee

 1 package com.xx.ssh.service;
 2 
 3 import java.util.List;
 4 
 5 import com.xx.ssh.dao.EmployeeDao;
 6 import com.xx.ssh.entities.Employee;
 7 
 8 public class EmployeeService {
 9     private EmployeeDao employeeDao;
10     
11     public void setEmployeeDao(EmployeeDao employeeDao)
12     {
13         this.employeeDao=employeeDao;
14     }
15     public boolean lastNameIsValid(String lastName){
16         return employeeDao.getEmployeeByLastName(lastName)==null;
17     }
18     public void delete(Integer id){
19         employeeDao.delete(id);
20     }
21     public void saveOrUpdate(Employee employee){
22         employeeDao.saveOrUpdate(employee);
23     }
24     public List<Employee> getAll(){
25         List<Employee> employees=employeeDao.getAll();
26         /*employees.clear();*/
27         System.out.println(employees.size());
28         return employees;
29     }
30     public  Employee get(Integer id) {
31         // TODO Auto-generated method stub
32         return employeeDao.get(id);
33         
34     }
35     
36 }
View Code

配置文件:

applicationContext-beans.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xsi:schemaLocation="http://www.springframework.org/schema/beans 
 5     http://www.springframework.org/schema/beans/spring-beans.xsd">
 6     
 7     <bean id="employeeDao" class="com.xx.ssh.dao.EmployeeDao">
 8         <property name="sessionFactory" ref="sessionFactory"></property>
 9     </bean>
10     
11     <bean id="departmentDao" class="com.xx.ssh.dao.DepartmentDao">
12         <property name="sessionFactory" ref="sessionFactory"></property>
13     </bean>
14                                      
15     <bean id="employeeService" class="com.xx.ssh.service.EmployeeService">
16         <property name="employeeDao" ref="employeeDao"></property>
17     </bean>
18     
19     <bean id="departmentService" class="com.xx.ssh.service.DepartmentService">
20         <property name="departmentDao" ref="departmentDao"></property>
21     </bean>
22     
23     <bean id="employeeAction" class="com.xx.ssh.actions.EmployeeAction"
24         scope="prototype">
25         <property name="employssService" ref="employeeService"></property>
26         <property name="departmentService" ref="departmentService"></property>
27     </bean>
28 </beans>
View Code

applicationContext.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <beans xmlns="http://www.springframework.org/schema/beans"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xmlns:aop="http://www.springframework.org/schema/aop"
 5     xmlns:context="http://www.springframework.org/schema/context"
 6     xmlns:tx="http://www.springframework.org/schema/tx"
 7     xsi:schemaLocation="http://www.springframework.org/schema/beans 
 8         http://www.springframework.org/schema/beans/spring-beans.xsd
 9         http://www.springframework.org/schema/aop 
10         http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
11         http://www.springframework.org/schema/context 
12         http://www.springframework.org/schema/context/spring-context-4.0.xsd
13         http://www.springframework.org/schema/tx 
14         http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
15 
16     <!-- 导入资源文件 -->
17     <context:property-placeholder location="classpath:db.properties"/>
18 
19     <!-- 配置 C3P0 数据源 -->
20     <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
21         <property name="user" value="${jdbc.user}"></property>
22         <property name="password" value="${jdbc.password}"></property>
23         <property name="driverClass" value="${jdbc.driverClass}"></property>
24         <property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
25     </bean>
26     
27     <!-- 配置 SessionFactory -->
28     <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
29         <property name="dataSource" ref="dataSource"></property>
30         <property name="configLocation" value="classpath:hibernate.cfg.xml"></property>
31         <property name="mappingLocations" value="classpath:com/xx/ssh/entities/*.hbm.xml"></property>
32     </bean>
33     
34     <!-- 配置 Spring 的声明式事务 -->
35     <!-- 1. 配置 hibernate 的事务管理器 -->
36     <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
37         <property name="sessionFactory" ref="sessionFactory"></property>
38     </bean>
39 
40     <!-- 2. 配置事务属性 -->
41     <tx:advice id="txAdvice" transaction-manager="transactionManager">
42         <tx:attributes>
43             <tx:method name="get*" read-only="true"/>
44             <tx:method name="lastNameIsValid" read-only="true"/>
45             <tx:method name="*"/>
46         </tx:attributes>
47     </tx:advice>
48     
49     <!-- 3. 配置事务切入点, 再把事务属性和事务切入点关联起来 -->
50     <aop:config>
51         <aop:pointcut expression="execution(* com.xx.ssh.service.*.*(..))" id="txPointcut"/>
52         <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
53     </aop:config>
54 </beans>
View Code

db.properties

1 jdbc.user=root
2 jdbc.password=root
3 jdbc.driverClass=com.mysql.jdbc.Driver
4 jdbc.jdbcUrl=jdbc:mysql:///spring6
5 
6 jdbc.initPoolSize=5
7 jdbc.maxPoolSize=10
View Code

hibernate.cfg.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <!DOCTYPE hibernate-configuration PUBLIC
 3         "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
 4         "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 5 <hibernate-configuration>
 6     <session-factory>
 7         <!-- 配置hibernate的基本属性-->
 8         
 9         <!-- 方言 -->
10         <property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
11         
12         <!--是否显示及格式化SQL-->
13         <property name="hibernate.show_sql">true</property>
14         <property name="hibernate.format_sql">true</property>
15         
16         <!-- 生成数据表的策略 -->
17         <property name="hibernate.hbm2ddl.auto">update</property>
18         
19         <!--二级缓存相关  -->
20     </session-factory>
21 </hibernate-configuration>
View Code

struts.xml

 1 <?xml version="1.0" encoding="UTF-8" ?>
 2 <!DOCTYPE struts PUBLIC
 3     "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
 4     "http://struts.apache.org/dtds/struts-2.3.dtd">
 5 
 6 <struts>
 7 
 8     <constant name="struts.enable.DynamicMethodInvocation" value="false" />
 9     <constant name="struts.devMode" value="true" />
10 
11     <package name="default" namespace="/" extends="struts-default">
12     
13         <!-- 定义新的拦截器栈, 配置 prepare 拦截器栈的 alwaysInvokePrepare 参数值为 false -->
14         <interceptors>
15             <interceptor-stack name="sshStack">
16                 <interceptor-ref name="paramsPrepareParamsStack">
17                     <param name="prepare.alwaysInvokePrepare">false</param>
18                 </interceptor-ref>
19             </interceptor-stack>
20         </interceptors>
21         
22         <!-- 使用新的拦截器栈 -->
23         <default-interceptor-ref name="sshStack"></default-interceptor-ref>
24     
25         <action name="emp-*" class="employeeAction"
26             method="{1}">
27             <result name="list">/WEB-INF/views/emp-list.jsp</result>
28             <result type="stream" name="ajax-success">
29                 <param name="contentType">text/html</param>
30                 <param name="inputName">inputStream</param>
31             </result>    
32             <result name="input">/WEB-INF/views/emp-input.jsp</result>
33             <result name="success" type="redirect">/emp-list</result>
34         </action>
35             
36     </package>
37 
38 </struts>
View Code

xwork-conversion.properties :时间转换器配置文件。

java.util.Date=com.xx.ssh.converters.SSHDateConverter

web.xml

 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
 3     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 4     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
 5     http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 6 
 7 
 8     <context-param>
 9         <param-name>contextConfigLocation</param-name>
10         <param-value>classpath:applicationContext*.xml</param-value>
11     </context-param>
12     <listener>
13         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
14     </listener>  <!-- 为spring添加监听器 -->
15     <!-- 配置 Struts2 的 Filter -->
16     <filter>
17         <filter-name>struts2</filter-name>
18         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
19     </filter>
20     <filter-mapping>
21         <filter-name>struts2</filter-name>
22         <url-pattern>/*</url-pattern>
23     </filter-mapping>
24 </web-app>
View Code

JSP:

emp-input.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-1.8.0.js"></script>
<script type="text/javascript">$(function(){$(":input[name=lastName]").change(function(){var val= $(this).val();val=$.trim(val);var $this=$(this);if(val!=""){$this.nextAll("font").remove();var url="emp-validateLastName";var args={"lastName":val,"time":new Date()};$.post(url,args,function(data){//表示可用if(data == "1"){$this.after("<font color='green'>LastName可用</font>" );}//表示不可用else if(data == "0") {$this.after("<font color='red'>LastName不可用</font>" );}else{alert("服务器错误");}})}else{//alert("lastName 不能为空");var i=$(this).val("");alert(i);//this.focus();
            }})})
</script>
</head>
<body><s:debug></s:debug><h4>Employee Input Page</h4><s:form action="emp-save" method="post"><s:if test="id != null"><s:textfield name="lastName" label="LastName" disabled="true"></s:textfield><s:hidden name="id"></s:hidden><%-- <!-- 通过添加隐藏域的方式把未显式提交的字段值提交到服务器 --><s:hidden name="lastName"></s:hidden><s:hidden name="createTime"></s:hidden>--%></s:if><s:else><s:textfield name="lastName" label="LastName"></s:textfield></s:else><s:textfield name="email" label="Email"></s:textfield><s:textfield name="birth" label="Birth"></s:textfield><s:select list="#request.departments"listKey="id" listValue="departmentName" name="department.id"label="Department"></s:select><s:submit></s:submit>    </s:form></body>
</html>

emp-list.jsp:

<%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><!--  -->
<%@ taglib prefix="s" uri="/struts-tags"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/scripts/jquery-1.8.0.js"></script>
<script type="text/javascript" >$(function(){//1.点击delete时,弹出确定是要删除xx的信息吗。若确定,删除。反之。取消$(".delete").click(function(){var lastName=$(this).next(":input").val();var flag=confirm("确定是要删除"+lastName+"信息吗?");if(flag){var $tr=$(this).parent().parent();//删除,使用ajax方式 。var url=this.href;var args={"time":new Date()};$.post(url,args,function(data){//若data的返回值为1.则提示删除成功,且把当前行删除 。if(data=="1"){alert("删除成功");$tr.remove();}else{alert("删除失败");    }});}//取消默认行为。return false;});});</script>
</head>
<body><h4>Employee List Page</h4><s:if test="#request.employees == null || #request.employees.size()==0">没有任何员工信息;</s:if><s:else><table border="1" cellpadding="10" cellspacing="0"><tr><td>ID</td><td>LASTNAME</td><td>EMAIL</td><td>BIRTH</td><td>CREATETIME</td><td>DEPT</td><td>DELETE</td><td>Edit</td></tr><s:iterator value="#request.employees"><tr><td>${id } </td><td>${lastName }</td><td>${email }</td><td><s:date name="birth" format="yyyy-MM-dd"/></td><td><s:date name="birth" format="yyyy-MM-dd hh:mm:ss"/></td><td>${department.departmentName }</td><td><a href="emp-delete?id=${id }" class="delete">Delete</a><input type="hidden" value="${lastName }"/></td><td><a href="emp-input?id=${id }">Edit</a></td></tr></s:iterator></table></s:else>
</body>
</html>

整合过程出现的异常请点我:

 

posted on 2016-12-07 23:49 zhouixi 阅读(...) 评论(...) 编辑 收藏

转载于:https://www.cnblogs.com/1-Admin/p/6143299.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/255807.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ABB 机器人 添加多任务

首先&#xff0c;需要启用多任务选项的控制器。 要做到这一点&#xff0c;创建一个新的机器人控制器RobotStudio站 - >选择机器人&#xff08;控制器菜单&#xff09; - >.................. - >系统生成器 - >选择控制器 - >修改...下一页 - >下一步 - >…

分享12306抢票心得-终极秒杀思路篇

12306抢票的关键拼的就是整点出票的速度&#xff0c;快的几秒钟&#xff0c;慢的几分钟&#xff0c;本文提供终极抢票攻略&#xff0c;通过多线程扫描上万个CDN&#xff0c;来大幅度提升出票速度。准备一&#xff1a;需要了解CDN和切站的机制&#xff0c;请参考&#xff1a;分享…

JVM内幕:Java虚拟机详解

为什么80%的码农都做不了架构师&#xff1f;>>> 这篇文章解释了Java 虚拟机&#xff08;JVM&#xff09;的内部架构。下图显示了遵守 Java SE 7 规范的典型的 JVM 核心内部组件。 上图显示的组件分两个章节解释。第一章讨论针对每个线程创建的组件&#xff0c;第二章…

ABB机器人 系统参数配置

系统参数用于定义系统配置并在出厂时根据客户的需要定义。 可使用 FlexPendant 或 RobotStudio Online 编辑系统参数。 此步骤介绍如何查看 系统参数配置。 操作 &#xff1a; 1. 在 ABB 菜单上&#xff0c;点击控制面板。 2. 点击配置。显示选定主题的可用类型列表。 3. 点…

四则运算2开发简介

四则运算2在四则运算1的基础之上&#xff0c;又添加了新的功能&#xff0c;但是我觉得四则运算2的难度比四则运算1增大了很多&#xff0c;我在编程的过程中&#xff0c;遇到的最大难度就是不知该如何更好的融合各个功能之间的关系。 写到现在&#xff0c;四则运算2主要实现了以…

ABB机器人的 备份与恢复

保存内容 备份功能可保存上下文中的所有系统参数、系统模块和程序模块。 备份内容 数据保存于用户指定的目录中。 默认路径可加以设置。 目录分为四个子目录&#xff1a;Backinfo、Home、Rapid 和 Syspar。 System.xml 也保存于包含用户设置的 ../backup &#xff08;根…

【深度学习】——物体检测细节处理(NMS、样本不均衡、遮挡物体)

目录 一、候选框大量重叠问题 1、NMS核心思想 2、 步骤&#xff1a; 3、缺陷 4、改进 1&#xff09;soft NMS——衰减的方式来减小预测框的分类得分 2&#xff09;softer nms——增加了位置置信度 二、样本不平衡问题 1、不平滑的来源&#xff08;3方面&#xff09; 1&a…

第6章 循环结构

循环语句: 可以让一部分代码,反复执行 1.1 循环语句while while循环: 编写格式:while(条件){ 循环体 } 条件: 当条件是true,就执行循环体,执行完循环体后 程序再次执行while中的条件,如果条件还是true,继续执行循环体 直到条件是false的时候,循环就结束 public class WhileDem…

MongoDB复制集技术

为什么使用MongogDB复制集技术? mysql中:一主一从&#xff0c;一主多从结构存在的问题 1、 fileover&#xff08;故障转移&#xff09;a) 选主投票b) 切换 2、 是否对就用透明化 3、 数据补偿的问题a) 两阶段数据补偿 4、 解决方法 mysql中使用MHAVIP b…

Linux文件系统的实现 (图文并茂,比较好)

作者&#xff1a;Vamei 出处&#xff1a;http://www.cnblogs.com/vamei 欢迎转载&#xff0c;也请保留这段声明。谢谢&#xff01; Linux文件管理从用户的层面介绍了Linux管理文件的方式。Linux有一个树状结构来组织文件。树的顶端为根目录(/)&#xff0c;节点为目录&#xff0…

ROS探索总结(一)——ROS简介

随着机器人领域的快速发展和复杂化&#xff0c;代码的复用性和模块化的需求原来越强烈&#xff0c;而已有的开源机器人系统又不能很好的适应需求。2010年Willow Garage公司发布了开源机器人操作系统ROS&#xff08;robot operating system&#xff09;&#xff0c;很快在机器人…

利用union判断系统的大小端

int checkCPUendian()//返回1&#xff0c;为小端&#xff1b;反之&#xff0c;为大端&#xff1b; { union{ unsigned int a; unsigned char b; }c; c.a 1; return 1 c.b; }大端模式(Big-endian)&#xff0c;是指数据的高字节保存在内存的低地址中&#xff0c;而数据…

ROS探索总结(二)——ROS总体框架

一、 总体结构 根据ROS系统代码的维护者和分布来标示&#xff0c;主要有两大部分&#xff1a;&#xff08;1&#xff09;main&#xff1a;核心部分&#xff0c;主要由Willow Garage公司和一些开发者设计、提供以及维护。它提供了一些分布式计算的基本工具&#xff0c;以及整个…

【深度学习】——利用pytorch搭建一个完整的深度学习项目(构建模型、加载数据集、参数配置、训练、模型保存、预测)

目录 一、深度学习项目的基本构成 二、实战&#xff08;猫狗分类&#xff09; 1、数据集下载 2、dataset.py文件 3、model.py 4、config.py 5、predict.py 一、深度学习项目的基本构成 一个深度学习模型一般包含以下几个文件&#xff1a; datasets文件夹&#xff1a;存放…

GUI登录界面

在这次的作业中&#xff0c;我先使用单选按钮&#xff0c;输入框&#xff0c;复选框设计了一个简单地登录界面。接着我使用了MouseListener将登陆按钮与下一个“查询界面”连接起来。最后我使用了我们本周所学的JFrame框架与事件处理机制设计了一个简单地界面。我所设计的登录界…

浅谈ROS操作系统及其应用趋势

ROS操作系统是最先由斯坦福开发的开源机器人操作系统&#xff0c;目前由willowgarage公司开发和维护&#xff0c;相关的开发社区也很成熟&#xff08; http://www.ros.org &#xff0c; http://answers.ros.org, http://www.willowgarage.com), 经过几年的发展API也逐渐稳定&a…

CRM项目总结

CRM项目总结 一&#xff1a;开发背景 在公司日益扩大的过程中&#xff0c;不可避免的会伴随着更多问题出现。 对外 &#xff1a; 如何更好的管理客户与公司的关系&#xff1f;如何更及时的了解客户日益发展的需求变化&#xff1f;公司的产品是否真的符合客户需求&#xff1f;以…

js变量和数据类型

转载于:https://www.cnblogs.com/songyinan/p/6181421.html

(九)模板方法模式详解(包含与类加载器不得不说的故事)

作者&#xff1a;zuoxiaolong8810&#xff08;左潇龙&#xff09;&#xff0c;转载请注明出处&#xff0c;特别说明&#xff1a;本博文来自博主原博客&#xff0c;为保证新博客中博文的完整性&#xff0c;特复制到此留存&#xff0c;如需转载请注明新博客地址即可。 模板方法模…

阿里云openapi接口使用,PHP,视频直播

1.下载sdk放入项目文件夹中 核心就是aliyun-php-sdk-core&#xff0c;它的配置文件会自动加载相应的类 2.引入文件 include_once LIB_PATH . ORG/aliyun-openapi/aliyun-php-sdk-core/Config.php; 3.配置客户端对象,需要Access Key ID,Access Key Secret $iClientProfile Defa…