Logics of typical java based web application:-
- Request data gathering logic
- Form validation logic
- Business logic or request processing logic
- Persistence logic
- Session management logic
- Presentation logic
- Middle ware services
Request data gathering logic:-
It gathers various details from the client generated request being from web resource program like request parameter values (from data) request header values and other miscellaneous details.
- The process of verifying format and pattern of the form data by using java code / java script code is called as “form validation logic”.
Example– checking whether email id is having not, @symbols or not
- The main logic of the applications that process the request & generates the results is called as “business logic”.
- The logic that interacts with d/b s/w and manipulates data base table data is called as “persistence logic”(ex- jdbc code, hibernate code)
- The logic that remembers client data across the multiple requests during a session like sign to sign out is called as “session management logic”.
Use session tracking technique for this.
- Hidden form fields
- Cookies
- Http session with cookies
- Http session with url rewriting.
- The logic that generate user interface, formats the results given by business logic is called as “presentation logic” (html code).
- The additional services that is configurable on the applications to make app. Is perfect & manipulate in all the situations are called as “middle ware services”
Example: – jdbc connection pooling, transaction management, security etc.
Sample Servlet / JSP Program:-
- Read value 1, value 2 from the page as req param values.(req. data gathering logic)
- Check whether they are typed as numeric values or not(form validation logic)
- Int result = value 1 + value 2;(business logic)
- Store result in D-B s/w(persistence logic)
- Apply security service(middle ware service )
- Store form data in cookies(session management)
- Display result on browser window as table content. (presentation logic)