|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object shared.HelperBaseCh4 shared.HelperBaseCh5 ch5.postServlet.ControllerHelper
public class ControllerHelper
This controller helper is similar to the Required Validation example, except that it also accepts POST requests.
GET requests will be treated as first requests to the application and will not read data from the session and will always display the edit page. POST requests will implement the complete logic of previous controllers.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class shared.HelperBaseCh4 |
---|
HelperBaseCh4.SessionData |
Field Summary |
---|
Fields inherited from class shared.HelperBaseCh4 |
---|
logger, request, response |
Constructor Summary | |
---|---|
ControllerHelper(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
The only constructor for this class has parameters for the request and response objects. |
Method Summary | |
---|---|
java.lang.String |
confirmMethod()
The method that preforms the actions associated with the confirm button. |
void |
copyFromSession(java.lang.Object sessionHelper)
Most of the details for retrieving data from the session are implemented in the helper base class. |
void |
doGet()
This method will be called by the controller to finish processing the request. |
protected void |
doPost()
This method will be called by the controller to finish processing the request. |
java.lang.String |
editMethod()
The method that preforms the actions associated with the edit button. |
java.lang.Object |
getData()
Accessor that returns the bean. |
protected java.lang.String |
jspLocation(java.lang.String page)
Generates the full path to a JSP. |
java.lang.String |
processMethod()
The method that preforms the actions associated with the process button. |
Methods inherited from class shared.HelperBaseCh5 |
---|
getErrors, isValid, isValidProperty, setErrors |
Methods inherited from class shared.HelperBaseCh4 |
---|
addHelperToSession, addHelperToSession, executeButtonMethod, executeButtonMethod, fillBeanFromRequest, invokeButtonMethod, populateThrow, writeError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ControllerHelper(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
request
- The object that encapsulates the request
information that is needed to communicate
with the browser.response
- The object that encapsulates the response
information that is needed to communicate
with the browser.Method Detail |
---|
public java.lang.Object getData()
public void copyFromSession(java.lang.Object sessionHelper)
copyFromSession
in class HelperBaseCh4
sessionHelper
- The object that represents the controller helper that
was added to the session in the previous request.
During each request, the controller helper is placed in the session. Before that happens, the controller helper from the previous request can be retrieved from the session. This object is retrieved in the helper base class and sent to the implementation of this abstract method.
protected java.lang.String jspLocation(java.lang.String page)
page
- The name of the JSP. This will be appended to the
path of the directory that contains the JSPs. Using
this method forces all the JSPs to be in the same
directory.
public java.lang.String editMethod()
public java.lang.String confirmMethod()
If the data is valid, then the next page will be the confirm page. If the data is not valid, then the next page will be the edit page.
If there are errors, they will be displayed in the edit page.
public java.lang.String processMethod()
public void doGet() throws javax.servlet.ServletException, java.io.IOException
GET requests will be treated as first requests to the application. Previous data will not be retrieved from the session and the edit page will always be displayed.
doGet
in class HelperBaseCh4
javax.servlet.ServletException
- A servlet exception is a severe error
and means that processing cannot continue.
java.io.IOException
- An IO exception is a severe error
and means that processing cannot continue.protected void doPost() throws javax.servlet.ServletException, java.io.IOException
POST requests will implement the controller logic that has been in all previous controllers.
doPost
in class HelperBaseCh4
javax.servlet.ServletException
- A servlet exception is a severe error
and means that processing cannot continue.
java.io.IOException
- An IO exception is a severe error
and means that processing cannot continue.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |