public class JSP extends Object implements View
JSP files used in the framework must have a .jsp extension. The JSP servlet in the container must not be re-mapped to handle files with other extensions.
Modifier and Type | Field and Description |
---|---|
protected Map<String,Object> |
attributes |
protected String |
jsp |
Constructor and Description |
---|
JSP(String jsp)
Requires the name of the underlying JSP file.
|
JSP(String jsp,
String[] keys,
Object[] values) |
Modifier and Type | Method and Description |
---|---|
Object |
getAttribute(String key) |
Map<String,Object> |
getAttributes() |
String |
getJSPName()
Returns the name of the underlying JSP file.
|
<T> T |
getModel(Class<T> modelClass)
This method is meant to facilitate testing by providing a means of easily
getting the model representation described in the class's attributes.
|
void |
render(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
This method is invoked last in the sequence of steps involved in
processing a request sent to the FrontController.
|
void |
setAttribute(String key,
Object value) |
void |
setAttributes(Map<String,Object> attributes) |
void |
setAttributesFromPairs(String[] keys,
Object[] values) |
void |
setModel(Object javaBean) |
JSP |
withAttribute(String key,
Object value) |
JSP |
withAttributesFromPairs(String[] keys,
Object[] values) |
JSP |
withModel(Object javaBean) |
public JSP(String jsp)
jsp
- the name of the underlying JSP file represented by this Viewpublic void setModel(Object javaBean)
public <T> T getModel(Class<T> modelClass) throws Exception
This method is meant to facilitate testing by providing a means of easily getting the model representation described in the class's attributes.
T
- the model class typemodelClass
- the model classException
public String getJSPName()
public void render(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException
View
This method is invoked last in the sequence of steps involved in processing a request sent to the FrontController. The servlet request can be used to set any attributes, then to obtain a RequestDispatcher for forwarding or including, or the servlet response may be used to send a redirect, for example.
Users should note that any exceptions thrown from this method are not guaranteed to be caught in the FrontController. They may escape to the requestor. Users should handle any exceptions inside the implementation of this method if different behaviour is desired.
render
in interface View
request
- the servlet requestresponse
- the servlet responsejavax.servlet.ServletException
IOException
Copyright © 2011-2012 MojaveMVC.org