UNDERSTANDING MVC model
1. Understanding the model on Model View Controller (MVC):
With J2EE technology, Strategies for developing jsp code applies to a site is divided into multiple access levels for different ways or. In each of these levels applies complex ways to choose a suitable access. Include the following ways:
? Call java code directly: With the java code and jsp this way generally located a file, usually used only for those simple application.
? Call java code indirectly: Developing java class leave those out, only if necessary, the access call jsp page and insert into the java class.
? Use Bean: Developing those packets leaving the structure of the java bean, jsp pages using these hybrid taglib call these procedures or the subject of the java bean.
? Use MVC architecture model: There is a servlet will receive the requesr of jsp page, then look up the data, the data stored on these bean objects. Then transfer (forward) to jsp page and display the results. Use these to access counseling EL taglib or results.
? Use Customer tab: Under applies each tab will develop those characteristics described pursuant handler of the Sun and use the XML to use this tab. How to access this usually applies to those adult applies.
With access towards the MVC model has several special following points, all of these requests are required to be managed servlet, this servlet will access these classes call the bottom as: business-logic or accessdata the bottom, then stored information visually associates understand these dykes quua bean (model). Then jsp page will be hereby affirmatively request to (control) and display quua associates (view).
2. Set special MVC RequestDispatcher using:
Press the most important points in the MVC model is bussiness database layer and access layer separated leaving, with separate floors presentation. Here are ways necessary must do:
1. Definitions for these objects contain text display (presentation):
These groups this is a java object (java bean) and is written by a certain criteria. The attributes of this object has stored these functions to display content in user.
2. Use a servlet to manage these requests:
refers the same as before, servlets have read the mission variables in the request (parameters). Transfer orientation, distribution luoang these data go to the jsp page.
3. Creating these objects java bean in section 1, access database updates on the bean:
At this step, the servlet must do function coordinating data, data from databaseo take on these updated java bean.
4. Bring up those java bean request, session or servlet content: servlet processes will call setAttribute () of the request, session or servler content.
5. Transfer request directions to a jsp page:
After the subject has put forwarded necessary, specify a certain jsp page to transfer data by means of the interface RequestDispatcher forward formula.
6. Jsp page to receive and display the subject content:
Use taglib as: <jsp:useBean>, and the local items such as: <jsp:getProperty> obtain data for subjects that we remove or request on the session in step 4. Additionally Expression Language can be used to obtain data to display.
Download your Full Reports for Model View ControllerAdvertisement