- Modify service layer
modify the SimpleProductManager and add a reference to a ProductDao
'springapp/service/SimpleProductManager.java'
- remove the productManager configuration and the list of products from the springapp-servlet.xml
- configure the service layer in its own application context file 'applicationContext.xml'.
It will be loaded via a servlet listener that we will define in 'web.xml'
- 'springapp/web/WEB-INF/applicationContext.xml'
- using AOP (Aspect Oriented Programming) in the form of a transaction advice and an AspectJ pointcut to define where the transactions should
be applied
The pointcut applies to any method called on the ProductManager interface. The advice is a transaction advice that applies to methods with a name starting with 'save'.
- using the DBCP connection pool
- add lib spring-aspects & dbcp in dom.xml
Comments [0]
- Using mySQL
- Create database startup script
'springapp/db/create_products.sql'
'springapp/db/load_data.sql'
Run scripts and load test data
Comments [0]
we add a form that will allow the user to enter a percentage price increase
'springapp/web/WEB-INF/jsp/priceincrease.jsp'
'springapp/service/PriceIncrease.java'
'springapp/service/PriceIncreaseValidator.java'
add an entry in the 'springapp-servlet.xml' file to define the new
form and controller
+ define objects for commandClass and validator
+ formView and a successView
'springapp/web/WEB-INF/springapp-servlet.xml'
controller for this form
+ onSubmit(..) method: get command object
'springapp/web/PriceIncreaseFormController.java'
adding some messages to the 'messages.properties' resource file
'springapp/web/WEB-INF/classes/messages.properties'
add a link to the price increase page from the 'hello.jsp'
re--deploy & run
Comments [0]
Add reference to business logic in the controller
- rename HelloController to InventoryController and the HelloControllerTests to InventoryControllerTests
- modify the InventoryController to hold a reference to the ProductManager class
- add code to have the controller pass some product information to the view.
'/springapp/web/InventoryController.java'
Comments [0]
Comments [0]
- using the JSP Standard Tag Library (JSTL)
pom.xml
- create the header file for inclusion in all the JSPs we create.
'springapp/web/WEB-INF/jsp/include.jsp'
- Update HelloController
Comments [0]
- netbeans > new maven web app
- run index.jsp to see 'Hello World!' message

- Add spring web fw to project
Comments [0]
- enter about:config in the address bar
- right-click anywhere on the list and select New > Boolean : browser.urlbar.autoFill true
Comments [0]
Comments [0]