<? 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.0.xsd">
<Bean id = "datasource"
Class = "org. Apache. commons. DBCP. basicdatasource">
<Property name = "driverclassname"
Value = "com. Microsoft. JDBC. sqlserver. sqlserverdriver">
</Property>
<Property name = "url"
Value = "JDBC: Microsoft: sqlserver: // localhost: 1433; databasename = pubs; selectmethod = cursor">
</Property>
<Property name = "username" value = "sa"> </property>
</Bean>
<Bean id = "sessionfactory"
Class = "org. springframework. Orm. hibernate3.localsessionfactorybean">
<Property name = "datasource">
<Ref bean = "datasource"/>
</Property>
<Property name = "hibernateproperties">
<Props>
<Prop key = "hibernate. dialect">
Org. hibernate. dialect. sqlserverdialect
</Prop>
</Props>
</Property>
<Property name = "mappingresources">
<List>
<Value> hibernate/users. HBM. xml </value>
</List>
</Property>
</Bean>
<Bean id = "userdao" class = "Dao. impl. hibernateusersdaoimpl">
<Property name = "sessionfactory" ref = "sessionfactory"> </property>
</Bean>
<! --
Transaction equipment for Real Transaction Processing
-->
<Bean id = "transactionmanager"
Class = "org. springframework. Orm. hibernate3.hibernatetransactionmanager">
<Property name = "sessionfactory" ref = "sessionfactory"> </property>
</Bean>
<Bean id = "realfacade" class = "Facade. Facade">
<Property name = "userdao" ref = "userdao"> </property>
</Bean>
<! -- Configure abstract AOP -->
<Bean id = "abstractproxy" abstract = "true"
Class = "org. springframework. transaction. Interceptor. transactionproxyfactorybean">
<Property name = "transactionmanager" ref = "transactionmanager"/>
<Property name = "transactionattributes">
<Props>
<Prop key = "insert *"> propagation_required </prop>
<Prop key = "Update *"> propagation_required </prop>
<Prop key = "delete *"> propagation_required </prop>
<Prop key = "Login *"> propagation_required, readonly </prop>
<Prop key = "get *"> propagation_required, readonly </prop>
</Props>
</Property>
</Bean>
<! -- Configure a specific proxy -->
<Bean id = "Facade" parent = "abstractproxy">
<Property name = "target" ref = "realfacade"> </property>
</Bean>
<Bean name = "/login" class = "struts. Action. loginaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/update" class = "struts. Action. updateaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/Delete" class = "struts. Action. deleteaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/insert" Class = "struts. Action. insertaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/getbyusername"
Class = "struts. Action. getbyusernameaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/getall" class = "struts. Action. getallaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
<Bean name = "/getpage" class = "struts. Action. getpageaction">
<Property name = "Facade" ref = "Facade"> </property>
</Bean>
</Beans>
In struts-config.xml:
<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype Struts-config public "-// Apache Software Foundation // DTD struts configuration 1.3 //" http://struts.apache.org/dtds/struts-config_1_3.dtd ">
<Struts-config>
<Form-beans>
<Form-bean name = "usersform" type = "struts. Form. usersform"/>
</Form-beans>
<Global-exceptions/>
<Global-forwards>
<Forward name = "success" Path = "/success. jsp"/>
<Forward name = "error" Path = "/error. jsp"/>
</Global-forwards>
<Action-mappings>
<Action
Attribute = "usersform"
Name = "usersform"
Path = "/Insert"
Scope = "request"
Type = "org. springframework. Web. Struts. delegatingactionproxy"/>
<Action
Attribute = "usersform"
Name = "usersform"
Path = "/update"
Scope = "request"
Type = "org. springframework. Web. Struts. delegatingactionproxy"/>
<Action
Attribute = "usersform"
Name = "usersform"
Path = "/Delete"
Scope = "request"
Type = "org. springframework. Web. Struts. delegatingactionproxy"/>
<Action
Attribute = "usersform"
Name = "usersform"
Path = "/getbyusername"
Scope = "request"
Type = "org. springframework. Web. Struts. delegatingactionproxy">
<Forward name = "success" Path = "/update. jsp"/>
</Action>
<Action
Path = "/login"
Type = "org. springframework. Web. Struts. delegatingactionproxy">
<Forward name = "success" Path = "/index. jsp"/>
</Action>
<Action
Path = "/getall"
Type = "org. springframework. Web. Struts. delegatingactionproxy">
<Forward name = "success" Path = "/getpage. Do"/>
</Action>
<Action
Path = "/getpage"
Type = "org. springframework. Web. Struts. delegatingactionproxy">
<Forward name = "success" Path = "/userlist. jsp"/>
</Action>
</Action-mappings>
<Message-resources parameter = "struts. applicationresources"/>
<Plug-in classname = "org. springframework. Web. Struts. contextloaderplugin">
<Set-Property = "contextconfiglocation" value = "/WEB-INF/applicationcontext. xml"/>
</Plug-in>
</Struts-config>