Please bear in mind, the Action class which represent as controller layer, should not contain any business logic code and database access code. The best pratice is to apply the DAO mechanism by putting your business logic or database access code within the model layer.
The datasource should only define within the struts-config.xml when there is a limitation of connectivity to the database within the model layer. Alternative, you can use the JNDI to define the datasource and that would be the best recommendation in best pratice. However, that will be my next post on my blog.
Here are the summary of development been used.
- Struts 1.2.9 framework
- index.jsp, selectBook.jsp, SelectBookActionForm.java - view layer
- SelectBookAction.java - controller layer
- Book.java - data layer
- Defining datasouce at struts-config.xml
- MySQL database
No comments:
Post a Comment