|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object hirondelle.web4j.action.ActionImpl hirondelle.web4j.action.ActionTemplateSearch
public abstract class ActionTemplateSearch
Template for search screens.
Here, a search action has the following :
Search operations never require a redirect operation (since they do not edit the database).
Search operations have an interesting property : if you build a Model Object to validate and represent
user input into the search form, then its getXXX methods can usually be made package-private, instead
of public. The reason is that such Model Objects are usually not used by JSPs directly.
If desired, such methods can safely return String instead of
SafeText
. (The Model Objects themselves cannot be made package-private, since
the ModelFromRequest
class works only with public classes.)
Field Summary | |
---|---|
static RequestParameter |
SUPPORTED_OPERATION
The operations supported by this template. |
Fields inherited from class hirondelle.web4j.action.ActionImpl |
---|
DATA, ERRORS, ITEM_FOR_EDIT, ITEMS_FOR_LISTING, MESSAGES, USER_ID |
Constructor Summary | |
---|---|
protected |
ActionTemplateSearch(ResponsePage aForward,
RequestParser aRequestParser)
Constructor. |
Method Summary | |
---|---|
ResponsePage |
execute()
Template method. |
protected abstract void |
listSearchResults()
Query the database, and place the results (usually) into request scope. |
protected abstract void |
validateUserInput()
Validate items input by the user into a form. |
Methods inherited from class hirondelle.web4j.action.ActionImpl |
---|
addError, addError, addError, addMessage, addMessage, addToRequest, addToSession, copyFromSessionToRequest, createSessionAndCsrfToken, endSession, getErrors, getExistingSession, getFromSession, getIdParam, getIdParams, getLocale, getLoggedInUserName, getMessages, getOperation, getOrderBy, getParam, getParamUnsafe, getRequestParser, getResponsePage, getTimeZone, getUserId, hasErrors, removeFromSession, setResponsePage |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final RequestParameter SUPPORTED_OPERATION
The supported operations are :
The source of the Operation is described byActionImpl.getOperation()
.
Constructor Detail |
---|
protected ActionTemplateSearch(ResponsePage aForward, RequestParser aRequestParser)
aForward
- renders the result of the searchaRequestParser
- passed to the superclass constructor.Method Detail |
---|
public ResponsePage execute() throws AppException
In order to clearly understand the operation of this method, here is the core of its implementation, with all abstract methods in italics :
if (Operation.Show == getOperation() ){ //default forward } else if ( Operation.Search == getOperation() ){ validateUserInput(); if( ! hasErrors() ){ listSearchResults(); if ( ! hasErrors() ){ fLogger.fine("List executed successfully."); } } }
execute
in interface Action
execute
in class ActionImpl
AppException
protected abstract void validateUserInput() throws AppException
The form is used to define the criteria for the search (if any).
Applies only for Operation.Search
. If an error occurs, then
addError must be called.
AppException
protected abstract void listSearchResults() throws AppException
AppException
|
Version 4.10.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |