The framework of ssi is mainly composed of struts2, spring and ibaTIs. They are responsible for the interaction and collaboration between the layers, thus realizing the function realization and integration of the entire web. Struts is currently responsible for data transfer and control. Spring relies on its powerful dependency injection technology to implement functions like bean hosting and integration. Of course, this is just the tip of the iceberg in the spring function, and ibaTIs as a lightweight OR Mapping. The framework provides a semi-automated object-relational mapping implementation with a higher degree of freedom than hibernate.
Framework:This is a structure diagram I found on the Internet about the ssi framework. I personally feel that the painting is quite good. For beginners, the level structure is very clear and practical (thanks to this big sharing):
Here you can clearly see the general structure of the ssi framework and the interaction between the layers. If the top-level presentation layer is Java, it is mainly the preparation of view layer technology such as jsp and html, which involves the familiar javascript. Jquery and extjs, etc. In the control layer, the strust2 tag function is used to implement the data interaction between the acTIon and the view layer. Of course, the same function can be implemented using the ajax technology, which is based on personal preference. At the business logic level. Mainly to use Spring's dependency injection to implement instance management of business logic classes and dao classes, of course, all kinds of instances can be managed in the spring for unified management and association, including transactions, data sources and so on. In the persistence layer, using the semi-automated object-relational mapping provided by ibaTIs, developers can write specific SQL statements as needed, and implement the operation of the database through the corresponding xml configuration.
In short, the SSI framework can reduce the coupling of our code, enhance the robustness and reusability of the code, and speed up the development, but there are also some shortcomings, such as due to the more configuration files of the three frameworks, also bring us Some inconvenience, especially for smaller applications.
SSI framework builds quickly1. Right click on New in the Package Explore and select the web project.
2. Enter the project name and click finish.
3, import struts2
(1):
(2): Select Struts2.1 and select /*click next
(3): By default, click finish, import is complete
2, add Spring support
(1) Right click project, select Add Spring Capabilities
(2), check the jar package, and select the second item in the JAR Library Installation, click next
(3), modify the Folder for WebRoot/WEB-INF click finish to complete the introduction of Spring
3, start to configure ibatis
(1), add a configuration file in the applicationContext.xml file
(2), create a new path org.wwy.utils under src add sqlMapping.properties file
Jdbc.url=jdbc\:mysql\://localhost\:3307/MyBatis
Jdbc.username=root
Jdbc.password=wwy520223
(3), add sqlMapConfig.xml file under org.wwy.utils
(4), create a new entity package org.wwy.PO under src to write java entity class
Package org.wwy.PO;
Public class User {
Private Long id;
Private String name;
Private String pwd;
Private Long age;
Private long sex;
Public Long getId() {
Return id;
}
Public void setId(Long id) {
This.id = id;
}
Public String getName() {
Return name;
}
Public void setName(String name) {
This.name = name;
}
Public String getPwd() {
Return pwd;
}
Public void setPwd(String pwd) {
This.pwd = pwd;
}
Public Long getAge() {
Return age;
}
Public void setAge(Long age) {
This.age = age;
}
Public Long getSex() {
Return sex;
}
Public void setSex(Long sex) {
This.sex = sex;
}
}
(5), add User.xml mapping file under org.wwy.PO
4, add spring listener in web.xml
Complete SSI framework construction
5, start tomcat test SSI framework, error:
Caused by: java.lang.ClassNotFoundException: com.ibatis.common.xml.NodeletException
At org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324)
At org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177)
. .. 33 more
6. Download the ibatis jar package and copy it to the WEB-INF/lib directory, then import it from the buildpath and retest it.
CCTV Tester,Cctv Camera Tester,Monitor Tester,IP Camera Test Monitor
Chinasky Electronics Co., Ltd. , https://www.cctv-products.com