|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshared.HelperBaseCh4
shared.HelperBaseCh5
shared.HelperBaseCh6
ch7.accountLogin.ControllerHelper
ch7.accountCookie.ControllerHelper
public class ControllerHelper
Write the cookie when new data is saved; read the cookie when a new request is started.
The cookie will be read in the method that is called when a Get request is made. This is considered a new request, so only read the cookie at that time.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class shared.HelperBaseCh4 |
|---|
HelperBaseCh4.SessionData |
| Field Summary |
|---|
| Fields inherited from class ch7.accountLogin.ControllerHelper |
|---|
data |
| Fields inherited from class shared.HelperBaseCh6 |
|---|
checked, selected |
| Fields inherited from class shared.HelperBaseCh4 |
|---|
logger, request, response |
| Constructor Summary | |
|---|---|
ControllerHelper(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Call the base class constructor to store the request and response. |
|
| Method Summary | |
|---|---|
protected void |
doGet()
GET is considered a new request, so the old data is not read and the JSP is always for the edit page. |
protected void |
doPost()
Call the super class doPost method. |
java.lang.String |
getMethod()
The default method. |
java.lang.String |
jspLocation(java.lang.String page)
Encapsulates the location of the JSPs. |
java.lang.String |
newUserMethod()
If new user is cliked, then create a new bean and go to the login page. |
java.lang.String |
processMethod()
The method to call when the process button is clicked. |
| Methods inherited from class ch7.accountLogin.ControllerHelper |
|---|
confirmMethod, copyFromSession, editMethod, getData, initHibernate, loginMethod |
| Methods inherited from class shared.HelperBaseCh6 |
|---|
addChecked, addChoice, addSelected, clearMaps, clearProperty, getChecked, getSelected, invokeGetter, setCheckedAndSelected, setCheckedAndSelected |
| Methods inherited from class shared.HelperBaseCh5 |
|---|
getErrors, isValid, isValidProperty, setErrors |
| Methods inherited from class shared.HelperBaseCh4 |
|---|
addHelperToSession, addHelperToSession, executeButtonMethod, executeButtonMethod, fillBeanFromRequest, invokeButtonMethod, 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 - Request information encapsulated in a Java objectresponse - Response information encapsulated in a Java object| Method Detail |
|---|
public java.lang.String jspLocation(java.lang.String page)
jspLocation in class ControllerHelperpage - The file name of the JSP.
public java.lang.String getMethod()
Look for a cookie named "account". If it exists, then look for an account with the value of the cookie in the database. If it is there, then set the database bean as the current data and go to the edit page; otherwise, go to the login page.
getMethod in class ControllerHelperpublic java.lang.String newUserMethod()
newUserMethod in class ControllerHelperpublic java.lang.String processMethod()
Test if the data is still valid; if it isn't, then the session has expired. If the data is valid, then save it to the database
Write the account number to a cookie named "account".
Retrieve all the data from the database and add it to the request so that the JSPs can access it.
The method is adorned with a ButtonMethod annotation that associates the name of a button with the method.
processMethod in class ControllerHelper
protected void doGet()
throws javax.servlet.ServletException,
java.io.IOException
doGet in class ControllerHelperjavax.servlet.ServletException
java.io.IOException
protected void doPost()
throws javax.servlet.ServletException,
java.io.IOException
POST is considered a continuation of a previous request, so read the old data from the session and calculate the next page based on the button.
doPost in class ControllerHelperjavax.servlet.ServletException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||