Spring+Struts2+Mybatis
Spring-framework-3.2.4.RELEASE jar package:
Spring-aop-3.2.4.RELEASE.jar
Spring-aspects-3.2.4.RELEASE.jar
Spring-beans-3.2.4.RELEASE.jar
Spring-context-3.2.4.RELEASE.jar
Spring-core-3.2.4.RELEASE.jar
Spring-expression-3.2.4.RELEASE.jar
Spring-jdbc-3.2.4.RELEASE.jar
Spring-orm-3.2.4.RELEASE.jar
Spring-tx-3.2.4.RELEASE.jar
Spring-web-3.2.4.RELEASE.jar
Spring-context-support-3.2.4.RELEASE.jar
Download address: https://repo.spring.io/webapp/#/artifacts/browse/tree/search/
Quick/eyJzZWFyY2giOiJxdWljayIsInF1ZXJ5Ijoic3ByaW5nLWZyYW1ld29yayJ9
Struts-2.3.24.1 jar package:
Commons-fileupload-1.3.1.jar
Commons-io-2.2.jar
Commons-lang3-3.2.jar
Commons-logging.jar
Commons-logging-1.1.3.jar
Freemarker-2.3.22.jar
Javassist-3.11.0.GA.jar
Ognl-3.0.6.jar
Struts2-core-2.3.24.1.jar
Struts2-spring-plugin-2.3.4.1.jar
Aopalliance-1.0.jar
Xwork-core-2.3.24.1.jar
Download address: http://archive.apache.org/dist/struts/2.3.24/
Mybatis-3.3.0 jar package:
Log4j-1.2.17.jar
Mybatis-3.3.0.jar
Download address: https://github.com/mybatis/mybatis-3/releases
Other jar packages:
Ojdbc14.jar
Mybatis-spring-1.2.1.jar
Servlet-api-2.5-6.1.9.jar
Aspectjweaver.jar
Wsdl4j.jar
-obscure dividing line-
Web.xml (copied from the Struts2 folder)
Location: / WEB-INF/web.xml
Content:
Student management
ContextConfigLocation
Classpath:applicationContext.xml
Org.springframework.web.util.Log4jConfigListener
Log4jConfigLocation
Classpath:log4j.properties
Org.springframework.web.context.ContextLoaderListener
CharacterEncoding
Org.springframework.web.filter.CharacterEncodingFilter
Encoding
UTF-8
ForceEncoding
True
CharacterEncoding
/ *
Struts2
Org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
Struts2
/ *
five
/ index.jsp
-obscure dividing line-
ApplicationContext.xml
Location: src/applicationContext.xml
Content:
Classpath:jdbc.properties
${jdbc.driver}
${jdbc.url}
${jdbc.user}
${jdbc.pwd}
-obscure dividing line-
Jdbc.properties file
Location: / src/jdbc.properties
Content:
Jdbc.driver = oracle.jdbc.driver.OracleDriver
Jdbc.url = jdbc:oracle:thin:@127.0.0.1:1521:orcl
Jdbc.user =
Jdbc.pwd = 123456
-obscure dividing line-
Log4j.properties file
Location: / src/log4j.properties
Content:
Log4j.properties file
Location: / src/log4j.properties
Content:
Log4j.rootLogger=debug,stdout,logfile
Log4j.appender.stdout=org.apache.log4j.ConsoleAppender
Log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
Log4j.appender.stdout.layout.ConversionPattern= d% p [% c] -% n
Log4j.appender.logfile=org.apache.log4j.FileAppender
Log4j.appender.logfile.File=C:/\ student.log
Log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
Log4j.appender.logfile.layout.ConversionPattern= [% d {yyyy-MM-dd HH:mm:ss}]% l% F% p% m% n
Log4j.appender.logfile.Encoding=utf-8
Log4j.category.org.springframework=WARN
Log4j.category.org.springframework=WARN
Log4j.category.org.apache.struts2=WARN
Log4j.category.com.opensymphony.xwork2=WARN
Log4j.category.com.ibatis=WARN
Log4j.category.com.mybatis=WARN
Log4j.category.org.apache.ibatis.logging.commons=WARN
-obscure dividing line-
Mybatis_config.xml file
Location: / src/mybatis_config.xml
Content:
-obscure dividing line-
Struts.xml file
File location: / src/struts.xml
Contents of the file:
/ index.jsp
-obscure dividing line-
StudentMapper.xml
File location: / src/studentMapper.xml
Contents of the file:
Select * from student
Insert into student (STUNO,NAME) values (# {stuNo}, # {name})
-obscure dividing line-
/ WebContent/index.jsp
File location: / WebContent/index.jsp, other file locations: / WebContent/WEB-INF/page/
Contents of the file:
Hello World
${message}
Please enter a name:
-obscure dividing line-
File: HelloWorldAction.java
Location: src/com/shenzhen/management/action/HelloWorldAction.java
Content:
Public class HelloWorldAction implements Action {
Private Student student = null
Private String message = ""
Private StudentService studentService = null
@ Override
Public String execute () throws Exception {
This.message = student.getName ()
List students = studentService.getStudents ()
Return SUCCESS
}
}
-obscure dividing line-
File: StudentDaoImpl.java
Location: / src/com/shenzhen/management/dao/impl/StudentDaoImpl.java
Content:
Import java.util.List
Import org.mybatis.spring.SqlSessionTemplate
Import com.shenzhen.management.dao.StudentDao
Import com.shenzhen.management.pojo.Student
Public class StudentDaoImpl implements StudentDao {
Private SqlSessionTemplate sqlSessionTemplate
Public SqlSessionTemplate getSqlSessionTemplate () {
Return sqlSessionTemplate
}
Public void setSqlSessionTemplate (SqlSessionTemplate sqlSessionTemplate) {
This.sqlSessionTemplate = sqlSessionTemplate
}
@ Override
Public List getStudents () {
List students = null
Students = sqlSessionTemplate.selectList ("com.shenzhen.management.getStudents")
Return students
}
@ Override
Public void addStudent (Student student) {
SqlSessionTemplate.insert ("com.shenzhen.management.addStudent", student)
}
}
-obscure dividing line-
JDK: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Tomcat: http://tomcat.apache.org/download-70.cgi#7.0.69
Eclipse: http://eclipse.bluemix.net/packages/mars.2/
FileZilla
PuTTY
Notepad++
SOAPUI
Jd-gui.exe