| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface View
MVC View for a web interaction. Implementations are responsible for rendering content, and exposing the model. A single view exposes multiple model attributes.
This class and the MVC approach associated with it is discussed in Chapter 12 of Expert One-On-One J2EE Design and Development by Rod Johnson (Wrox, 2002).
View implementations may differ widely. An obvious implementation would be JSP-based. Other implementations might be XSLT-based, or use an HTML generation library. This interface is designed to avoid restricting the range of possible implementations.
Views should be beans. They are likely to be instantiated as beans by a ViewResolver. As this interface is stateless, view implementations should be thread-safe.
AbstractView, 
InternalResourceView| Field Summary | |
|---|---|
| static String | RESPONSE_STATUS_ATTRIBUTEName of the HttpServletRequestattribute that contains the response status code. | 
| Method Summary | |
|---|---|
|  String | getContentType()Return the content type of the view, if predetermined. | 
|  void | render(Map<String,?> model,
       HttpServletRequest request,
       HttpServletResponse response)Render the view given the specified model. | 
| Field Detail | 
|---|
static final String RESPONSE_STATUS_ATTRIBUTE
HttpServletRequest attribute that contains the response status code.
 Note: This attribute is not required to be supported by all View implementations.
| Method Detail | 
|---|
String getContentType()
Can be used to check the content type upfront, before the actual rendering process.
null if not predetermined.
void render(Map<String,?> model,
            HttpServletRequest request,
            HttpServletResponse response)
            throws Exception
The first step will be preparing the request: In the JSP case, this would mean setting model objects as request attributes. The second step will be the actual rendering of the view, for example including the JSP via a RequestDispatcher.
model - Map with name Strings as keys and corresponding model
 objects as values (Map can also be null in case of empty model)request - current HTTP requestresponse - HTTP response we are building
Exception - if rendering failed| 
 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||