20 likes | 143 Views
applicationContext.xml - define beans - wire service beans into controllers - wire dao beans into managers - map exceptions to pages …. spring. frontcontroller-servlet.xml - define controllers - resolve views. spring. Database. Web.xml
E N D
applicationContext.xml - define beans- wire service beans into controllers- wire dao beans into managers- map exceptions to pages… spring frontcontroller-servlet.xml - define controllers- resolve views... spring Database Web.xml load: spring applicationContext and frontcontroller –servlet mappings:*.jsp -> dispatchServlet SqlMapConfig.xml - Database / JDBC Config- sqlMap locaties … Ibatis sqlMap.xml (Ibatis) <sqlmap name=“getStudents”>SELECT * FROM STUDENTS</sqlmap> … web flow Command Object StudentUpdater StudentValidator Validate() getName()setName()… Client ApplicationController (d)html / custom javascript Data Access Object formController StudentDao FrontController authorManager.findStudentsByName() Handler() {// call business logic, // return model and view.} FrontcontrollerServlet Map findStudentsByName() { return sqlMap.getStudents(); } ModelAndView urlMapping:*.jsp appController…… resolve views map models to views render views get / post • view • model persistence ApplicationController ApplicationController simpleController Service Handler() {// call business logic, // return view.} StudentManager findStudentsByName() { students = StudentDao.findStudentsByName(); // perform business logic on students: if(students==null) {StudentDao.helplist};return students;} web view service domain See Object-model
This layer encapsulates the business logic. It is built with JavaBeans. JavaBeans have a certain state (‘name’, ‘address’, …) and behaviour (‘register()’, …). • Goal is to encapsulate all business logic in the domain model. • All other layers depend on the domain layer. However: The domain layer may not depend on any other layer. • a.k.a.‘user-interface’ layer • responsible for the presentation towards the end-user. This layer presents (‘renders’) response data from the web-flow layer. • does not contain navigation and no business logic • contains Jsp’s (with images and stylesheets) and JavaScript (Ajax). web view • responsible for the navigation of the end-user. • transforms HTTP-requests into general requests (without HTTP specific matters) for the underlying service layer • does not contain business logic, but does call business logic in the service layer. • contains Servlets (Controller function) • uses POJO’s and the JavaBeans from the domain-layer. web flow • offers business logic to the web flow layer in the form of ‘coarse grained’ methods (this means that each method represents a use-case). These methods may not contain ‘state’. • handles concurrent requests and therefore has to be totally stateless ! • contains Manager-JavaBeans • uses POJO’s and the JavaBeans from the domain-layer. The JavaBeans will have to contain as much as possible the ‘real’ business logic. service • responsible for the storage and retrieval of objects from the domain model. Typical strategy herefor are the ‘CRUD’ methods. • can only be addressed by the service layer. The service layer is therefore responsible for the coordination of transactions. • uses the iBatis SQLMaps framework. persistence • responsible for the storage of data and not for business logic. Only in the case of persistency logic or performance matters it is acceptable to store logic in the database. database domain