|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectshared.HelperBaseCh4
shared.HelperBaseCh5
shared.HelperBaseCh6
ch6.complexPersistent.ControllerHelper
public class ControllerHelper
Saving complex elements to a database is the same as saving regular elements to the database.
There are no additional changes to the helper to save advanced HTML form elements.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class shared.HelperBaseCh4 |
|---|
HelperBaseCh4.SessionData |
| Field Summary |
|---|
| 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 | |
|---|---|
java.lang.String |
confirmMethod()
The method to call when the confirm button is clicked. |
void |
copyFromSession(java.lang.Object sessionHelper)
The implementation of the abstract method from the helper base. |
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()
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. |
java.lang.String |
editMethod()
The method to call when the edit button is clicked. |
java.lang.Object |
getData()
An accessor that allows the JSPs to retrieve the bean from the helper. |
static void |
initHibernate(boolean create)
The properties are in the hibernate.cfg.xml file. |
protected java.lang.String |
jspLocation(java.lang.String page)
Encapsulates the location of the JSPs. |
java.lang.String |
processMethod()
The method to call when the process button is clicked. |
void |
resetNullable()
Certain advanced form elements must be manually cleared, since there will be no data in the query string if nothing is selected. |
| 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 static void initHibernate(boolean create)
create - true means create the table, false means do not createpublic java.lang.Object getData()
public void copyFromSession(java.lang.Object sessionHelper)
copyFromSession in class HelperBaseCh4sessionHelper - The old helper that is still in the session.public void resetNullable()
protected java.lang.String jspLocation(java.lang.String page)
page - The file name of the JSP.
public java.lang.String editMethod()
The method does nothing else at this time than indicate the address of the page.
The method is adorned with a ButtonMethod annotation that associates the name of a button with the method.
public java.lang.String confirmMethod()
Reset all elements that are nullable.
Use the fillBeanFromRequest method to automatically copy the request data into the bean.
Call setCheckedAndSelected to initialise these elements.
Implement required validation by calling isValid. If the data is valid, then proceed to the confirm page; otherwise, return to the edit page.
The method is adorned with a ButtonMethod annotation that associates the name of a button with the method.
public 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. 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.
protected void doGet()
throws javax.servlet.ServletException,
java.io.IOException
doGet in class HelperBaseCh4javax.servlet.ServletException
java.io.IOException
protected void doPost()
throws javax.servlet.ServletException,
java.io.IOException
doPost in class HelperBaseCh4javax.servlet.ServletException
java.io.IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||