Implementing the View
As a software engineer, your team has selected to implement the model 2 J2EE architecture. Your team has been assigned the task of implementing the full server side handling of the of the View layer for the Home Town Bank system as defined in the requirements document. This is to include handling of the http request from the browser using servlets and generating and returning the HTML fragments using JSP pages. These HTML fragments are to be embedded in the web pages via AJAX.
Return and Report
Servlets
- Explain the Web-Tier Service Cycle defined in the Model 2 architecture.
- Draw a UML State diagram illustrating the life cycle of a servlet.
- How is information shared among collaborating web components?
- What does the HTTPServletRequest class represent? What is it’s scope and life span?
- What does the HTTPServletResponse class represent? What is it’s scope and life span?
- What does the HTTPSession class represent? What is it’s scope and life span?
- What does the ServletContext class represent? What is it’s scope and life span?
- What does the PageContext class represent? What is it’s scope and life span?
- What information can a servlet retrieve from a request?
- What information can a servlet send back to the browse via the HTTPServletResponse object?
- The HTTPServlet class contains the following methods: init(), destroy(), doGet(), doPost(), doPut() and doDelete(). What is the purpose of each of the functions, who calls them and when are they called?
- Walk through and explain a code snippet illustrating how a servlet can dynamicall generate HTML and send it back to the client browser.
- Walk thru and explain a code snippet of a servlet forwarding the request and response on to a different servlet, JSP or HTML page?
JSP
- Draw a UML State diagram illustrating the life cycle of a JSP page.
- What implicit objects are created for a JSP page.
- Give an example of a JSP declaration and explain its purpose.
- Give an example of a JSP scriplet and explain its purpse.
- Give an example of a JSP expression and explain its purpose.
- Contrast the two different ways that you can including other web resources (e.g., JSP or HTML source)
Design
Each member of the team is to switch use cases. Update the sequence diagrams for two of these use cases to use the model 2 J2EE architecture. Show all classes (i.e., Servlets, JSP pages, etc.) that you will be using in the sequence diagram to implement the View layer.
Implementation
Each member of the team is to implement one of the traded use cases using Servlets and JSP pages.
- Create a single class for all of the business methods defined in the the Control layer. Implement stub functions for each of the methods in the Control layer called for the use case. Each of these methods is to return a java bean containing sample data when appropriate.
- Create servlets to handle the request for each of the two use cases.
- Generate JSP pages for the response. Each JSP page should dynamically generate the appropriate HTML using the data returned from the stub business methods defined for the control layer.
- Run the entire application illustrating the the functioning use cases with sample data.
Key Words
- Model 2 Architecture
- Servlet Request (HttpRequest)
- Servlet Response (HttpResponse)
- HTTP GET and HTTP POST
- HTTP Parameters
- Attributes