Class SampleAction
java.lang.Object
org.apache.struts2.ActionSupport
org.conical.common.bbl.web.struts.actions.BaseAction
org.conical.common.bbl.web.struts.actions.SampleAction
- All Implemented Interfaces:
Serializable, org.apache.struts2.action.Action, org.apache.struts2.action.ServletRequestAware, org.apache.struts2.action.ServletResponseAware, org.apache.struts2.interceptor.ValidationAware, org.apache.struts2.locale.LocaleProvider, org.apache.struts2.text.TextProvider, org.apache.struts2.Validateable
This class exists as a simple child of BaseAction to show how little
code must be written to implement an action. It can be used as a
model for those learning Struts and the BBL Struts framework.
- Author:
- rdoherty
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseAction
BaseAction.DeveloperModifier and TypeClassDescriptionclassEncapsulates information about the contact developer for this application -
Field Summary
Fields inherited from class BaseAction
PERMISSION_DENIEDModifier and TypeFieldDescriptionprotected static final StringShould be returned when permission to view a page or perform an action is deniedFields inherited from class org.apache.struts2.ActionSupport
containerFields inherited from interface org.apache.struts2.action.Action
ERROR, INPUT, LOGIN, NONE, SUCCESS -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class BaseAction
addCookie, doAutoLogin, execute, getApplicationName, getApplicationProperties, getCookies, getCurrentUser, getDeveloper, getEthnicities, getHandednesses, getNameSuffixes, getRaces, getReligions, getRequestUrl, getRequiredAccessRoles, getSession, getSexes, getSexualOrientations, getStates, withServletRequest, withServletResponseModifier and TypeMethodDescriptionvoidaddCookie(jakarta.servlet.http.Cookie cookie) Adds the passed cookie to the HTTP responseprotected voidTry to log in user automatically using cookies or some other mechanism (implementation dependent).final Stringexecute()Method called by Struts to initiate action logic.Returns the name of this applicationReturns a map of application properties read from the application.properties file.List<jakarta.servlet.http.Cookie> final UserReturns the user currently logged into this application, or null if no one is logged in, if the user is no longer valid, or if an error occurs (the error having been logged).Returns the developer who should be contacted regarding this applicationgetRaces()Returns the original URL for this request.Returns the set of access roles required to execute this action (and access the associated page).Exposes session to child classes.getSexes()voidwithServletRequest(jakarta.servlet.http.HttpServletRequest request) voidwithServletResponse(jakarta.servlet.http.HttpServletResponse response) Methods inherited from class org.apache.struts2.ActionSupport
addActionError, addActionMessage, addFieldError, clearActionErrors, clearErrors, clearErrorsAndMessages, clearFieldErrors, clearMessages, clone, getActionErrors, getActionMessages, getContainer, getFieldErrors, getFormatted, getLocale, getLocaleProvider, getText, getText, getText, getText, getText, getText, getText, getText, getText, getTextProvider, getTexts, getTexts, hasActionErrors, hasActionMessages, hasErrors, hasFieldErrors, hasKey, input, isValidLocale, isValidLocaleString, pause, setActionErrors, setActionMessages, setContainer, setFieldErrors, toLocale, validate
-
Constructor Details
-
SampleAction
public SampleAction()
-
-
Method Details
-
actionRequiresLogin
protected boolean actionRequiresLogin()Returns true since most applications require login.- Specified by:
actionRequiresLoginin classBaseAction- Returns:
- true
-
doWork
Performs no side effects; simply returns success.- Specified by:
doWorkin classBaseAction- Returns:
- success
- Throws:
Exception- if something goes wrong
-