java SSH員工管理系統以及Demo程式碼下載

yaerfeng發表於2016-10-09

原文:java SSH員工管理系統以及Demo程式碼下載


專案截圖:

20140527001222702.jpg

資料庫指令碼:


CREATE DATABASE `company` default charset=utf8;
CREATE TABLE `employer` (
  `id` int(20) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(20) NOT NULL,
  `address` varchar(50) NOT NULL,
  `create_date` date NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

配置檔案:

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>dyl</groupId>
  <artifactId>ssh</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <url>http://maven.apache.org</url>

   <repositories>  
     <repository>  
         <id>java</id>  
         <name>java official repository</name>  
         <url>http://download.java.net/maven/2/</url>  
     </repository>  
 </repositories>
  
  <dependencies>
    <dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.5.0</version>
  </dependency>
  
        <dependency>
      <groupId>org.apache.struts</groupId>
      <artifactId>struts2-core</artifactId>
      <version>2.1.8</version>
        </dependency>
  
  <dependency>
         <groupId>org.apache.struts</groupId>
      <artifactId>struts2-spring-plugin</artifactId>
      <version>2.1.8</version>
        </dependency>
        
        <dependency>
   <groupId>mysql</groupId>
   <artifactId>mysql-connector-java</artifactId>
   <version>5.1.9</version>
  </dependency>
  
  <dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring</artifactId>
  <version>2.5.6</version>
 </dependency>
 <dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
  <version>2.5.6</version>
 </dependency>
 
 <dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate</artifactId>
  <version>3.2.7.ga</version>
 </dependency>
 
 <!-- Hibernate core library dependency start -->
 <dependency>
  <groupId>dom4j</groupId>
  <artifactId>dom4j</artifactId>
  <version>1.6.1</version>
 </dependency>
 
 <dependency>
  <groupId>commons-logging</groupId>
  <artifactId>commons-logging</artifactId>
  <version>1.1.1</version>
 </dependency>
 
 <dependency>
  <groupId>commons-collections</groupId>
  <artifactId>commons-collections</artifactId>
  <version>3.2.1</version>
 </dependency>
 
 <dependency>
  <groupId>cglib</groupId>
  <artifactId>cglib</artifactId>
  <version>2.1</version>
 </dependency>
 
 <dependency>
  <groupId>antlr</groupId>
  <artifactId>antlr</artifactId>
  <version>2.7.7</version>
 </dependency> 
         
    <dependency>
  <groupId>javassist</groupId>
  <artifactId>javassist</artifactId>
  <version>3.12.0.GA</version>
 </dependency>
         
  </dependencies>
</project>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
   
   <welcome-file-list>  
        <welcome-file>index.html</welcome-file>  
    </welcome-file-list>  
   
   <filter>
  <filter-name>structs-tags</filter-name>
  <filter-class>
                org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
        </filter-class>
 </filter>
 
 <filter-mapping>
  <filter-name>structs-tags</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 
   <listener>
     <listener-class>
       org.springframework.web.context.ContextLoaderListener
     </listener-class>
    </listener>
  <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>/WEB-INF/classes/SpringBeans.xml</param-value>
   </context-param>
  
</web-app>

struts.xml

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
 
<struts>
 <constant name="struts.action.extension" value="html" />
  <constant name="struts.devMode" value="true" />
 
 <package name="default" namespace="/" extends="struts-default">
 
  <action name="addEmployer" 
   class="employerAction" method="addEmployer" >
      <result name="success">/WEB-INF/views/Employer.jsp</result>
  </action>
 
  <action name="index"
   class="employerAction" method="listCustomer" >
      <result name="success">/WEB-INF/views/Employer.jsp</result>
  </action>
 
 </package>
 
</struts>

springBeans.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.springframework.org/schema/beans 
 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
 <import resource="./DataSource.xml"/>
 <import resource="./HibernateSessionFactory.xml"/>
 <import resource="./EmployerBean.xml"/>
 
</beans>

 

執行截圖:

20140527000756424.jpg

相關文章