CPD Results
The following document contains the results of PMD's CPD 6.55.0.
Duplications
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/el/exercise/TestBean.java | Struts Apps - EL Examples | 53 |
| org/apache/struts/webapp/exercise/TestBean.java | Struts Apps - Examples | 54 |
private Collection<LabelValueBean> beanCollection = null;
public Collection<LabelValueBean> getBeanCollection() {
if (beanCollection == null) {
ArrayList<LabelValueBean> entries = new ArrayList<>(10);
entries.add(new LabelValueBean("Label 0", "Value 0"));
entries.add(new LabelValueBean("Label 1", "Value 1"));
entries.add(new LabelValueBean("Label 2", "Value 2"));
entries.add(new LabelValueBean("Label 3", "Value 3"));
entries.add(new LabelValueBean("Label 4", "Value 4"));
entries.add(new LabelValueBean("Label 5", "Value 5"));
entries.add(new LabelValueBean("Label 6", "Value 6"));
entries.add(new LabelValueBean("Label 7", "Value 7"));
entries.add(new LabelValueBean("Label 8", "Value 8"));
entries.add(new LabelValueBean("Label 9", "Value 9"));
beanCollection = entries;
}
return (beanCollection);
}
public void setBeanCollection(Collection<LabelValueBean> beanCollection) {
this.beanCollection = beanCollection;
}
/**
* A multiple-String SELECT element using a bean collection.
*/
private String[] beanCollectionSelect = { "Value 1", "Value 3",
"Value 5" };
public String[] getBeanCollectionSelect() {
return (this.beanCollectionSelect);
}
public void setBeanCollectionSelect(String beanCollectionSelect[]) {
this.beanCollectionSelect = beanCollectionSelect;
}
/**
* A boolean property whose initial value is true.
*/
private boolean booleanProperty = true;
public boolean getBooleanProperty() {
return (booleanProperty);
}
public void setBooleanProperty(boolean booleanProperty) {
this.booleanProperty = booleanProperty;
}
/**
* A multiple-String SELECT element using a collection.
*/
private String[] collectionSelect = { "Value 2", "Value 4",
"Value 6" };
public String[] getCollectionSelect() {
return (this.collectionSelect);
}
public void setCollectionSelect(String collectionSelect[]) {
this.collectionSelect = collectionSelect;
}
/**
* A double property.
*/
private double doubleProperty = 321.0;
public double getDoubleProperty() {
return (this.doubleProperty);
}
public void setDoubleProperty(double doubleProperty) {
this.doubleProperty = doubleProperty;
}
/**
* A boolean property whose initial value is false
*/
private boolean falseProperty = false;
public boolean getFalseProperty() {
return (falseProperty);
}
public void setFalseProperty(boolean falseProperty) {
this.falseProperty = falseProperty;
}
/**
* A float property.
*/
private float floatProperty = (float) 123.0;
public float getFloatProperty() {
return (this.floatProperty);
}
public void setFloatProperty(float floatProperty) {
this.floatProperty = floatProperty;
}
/**
* Integer arrays that are accessed as an array as well as indexed.
*/
private int intArray[] = { 0, 10, 20, 30, 40 };
public int[] getIntArray() {
return (this.intArray);
}
public void setIntArray(int intArray[]) {
this.intArray = intArray;
}
private int intIndexed[] = { 0, 10, 20, 30, 40 };
public int getIntIndexed(int index) {
return (intIndexed[index]);
}
public void setIntIndexed(int index, int value) {
intIndexed[index] = value;
}
private int intMultibox[] = new int[0];
public int[] getIntMultibox() {
return (this.intMultibox);
}
public void setIntMultibox(int intMultibox[]) {
this.intMultibox = intMultibox;
}
/**
* An integer property.
*/
private int intProperty = 123;
public int getIntProperty() {
return (this.intProperty);
}
public void setIntProperty(int intProperty) {
this.intProperty = intProperty;
}
/**
* A long property.
*/
private long longProperty = 321;
public long getLongProperty() {
return (this.longProperty);
}
public void setLongProperty(long longProperty) {
this.longProperty = longProperty;
}
/**
* A multiple-String SELECT element.
*/
private String[] multipleSelect = { "Multiple 3", "Multiple 5",
"Multiple 7" };
public String[] getMultipleSelect() {
return (this.multipleSelect);
}
public void setMultipleSelect(String multipleSelect[]) {
this.multipleSelect = multipleSelect;
}
/**
* A nested reference to another test bean (populated as needed).
*/
private TestBean nested = null;
public TestBean getNested() {
if (nested == null) { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/SaveSubscriptionAction.java | Struts Apps - Faces Example 1 | 64 |
| org/apache/struts/webapp/example2/SaveSubscriptionAction.java | Struts Apps - Faces Example 2 | 64 |
private final static Logger LOG =
LoggerFactory.getLogger(SaveSubscriptionAction.class);
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Extract attributes and parameters we will need
MessageResources messages = getResources(request);
HttpSession session = request.getSession();
SubscriptionForm subform = (SubscriptionForm) form;
String action = subform.getAction();
if (action == null) {
action = "?";
}
LOG.debug("SaveSubscriptionAction: Processing {} action",
action);
// Is there a currently logged on user?
User user = (User) session.getAttribute(Constants.USER_KEY);
if (user == null) {
LOG.trace(" User is not logged on in session {}",
session.getId());
return (mapping.findForward("logon"));
}
// Was this transaction cancelled?
if (isCancelled(request)) {
LOG.trace(" Transaction '{}' was cancelled",
action);
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
return (mapping.findForward("success"));
}
// Is there a related Subscription object?
Subscription subscription =
(Subscription) session.getAttribute(Constants.SUBSCRIPTION_KEY);
if ("Create".equals(action)) {
LOG.trace(" Creating subscription for mail server '{}'",
subform.getHost());
subscription =
user.createSubscription(subform.getHost());
}
if (subscription == null) {
LOG.trace(" Missing subscription for user '{}'",
user.getUsername());
response.sendError(HttpServletResponse.SC_BAD_REQUEST,
messages.getMessage("error.noSubscription"));
return (null);
}
// Was this transaction a Delete?
if (action.equals("Delete")) {
LOG.trace(" Deleting mail server '{}' for user '{}'",
subscription.getHost(), user.getUsername());
user.removeSubscription(subscription);
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
try {
UserDatabase database = (UserDatabase)
servlet.getServletContext().
getAttribute(Constants.DATABASE_KEY);
database.save();
} catch (Exception e) {
LOG.error("Database save", e);
}
return (mapping.findForward("success"));
}
// All required validations were done by the form itself
// Update the persistent subscription information
LOG.trace(" Populating database from form bean");
try {
PropertyUtils.copyProperties(subscription, subform);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null)
t = e;
LOG.error("Subscription.populate", t);
throw new ServletException("Subscription.populate", t);
} catch (Throwable t) {
LOG.error("Subscription.populate", t);
throw new ServletException("Subscription.populate", t);
}
try {
UserDatabase database = (UserDatabase)
servlet.getServletContext().
getAttribute(Constants.DATABASE_KEY);
database.save();
} catch (Exception e) {
LOG.error("Database save", e);
}
// Remove the obsolete form bean and current subscription
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
// Forward control to the specified success URI
LOG.trace(" Forwarding to success page");
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 1 | 61 |
| org/apache/struts/webapp/example2/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 2 | 61 |
public final class MemoryDatabasePlugIn implements PlugIn {
// ----------------------------------------------------- Instance Variables
/**
* The {@link MemoryUserDatabase} object we construct and make available.
*/
private MemoryUserDatabase database = null;
/**
* The {@code Log} instance for this class.
*/
private final static Logger LOG =
LoggerFactory.getLogger(MemoryDatabasePlugIn.class);
/**
* The {@link ActionServlet} owning this application.
*/
private ActionServlet servlet = null;
// ------------------------------------------------------------- Properties
/**
* The web application resource path of our persistent database
* storage file.
*/
private String pathname = "/WEB-INF/database.xml";
public String getPathname() {
return (this.pathname);
}
public void setPathname(String pathname) {
this.pathname = pathname;
}
// --------------------------------------------------------- PlugIn Methods
/**
* Gracefully shut down this database, releasing any resources
* that were allocated at initialization.
*/
public void destroy() {
LOG.info("Finalizing memory database plug in");
if (database != null) {
try {
database.close();
} catch (Exception e) {
LOG.error("Closing memory database", e);
}
}
servlet.getServletContext().removeAttribute(Constants.DATABASE_KEY);
database = null;
servlet = null;
database = null;
}
/**
* Initialize and load our initial database from persistent storage.
*
* @param servlet The ActionServlet for this web application
* @param config The ApplicationConfig for our owning module
*
* @throws ServletException if we cannot configure ourselves correctly
*/
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
LOG.info("Initializing memory database plug in from '{}'",
pathname);
// Remember our associated configuration and servlet
this.servlet = servlet;
// Construct a new database and make it available
database = new MemoryUserDatabase();
try {
String path = calculatePath();
LOG.debug(" Loading database from '{}'", path);
database.setPathname(path);
database.open();
} catch (Exception e) {
LOG.error("Opening memory database", e);
throw new ServletException("Cannot load database from '" +
pathname + "'", e);
}
// Make the initialized database available
servlet.getServletContext().setAttribute(Constants.DATABASE_KEY,
database);
// Setup and cache other required data
setupCache(servlet, config);
}
// --------------------------------------------------------- Public Methods
// ------------------------------------------------------ Protected Methods
/**
* <p>Cache commonly required data as servlet context attributes.</p>
*
* @param servlet The <code>ActionServlet</code> instance running
* this webapp
* @param config The <code>ModuleConfig</code> for this application module
*/
protected void setupCache(ActionServlet servlet, ModuleConfig config) {
// Set up list of server types under "serverTypes"
ArrayList<LabelValueBean> serverTypes = new ArrayList<>();
serverTypes.add(new LabelValueBean("IMAP Protocol", "imap"));
serverTypes.add(new LabelValueBean("POP3 Protocol", "pop3"));
servlet.getServletContext().setAttribute("serverTypes", serverTypes);
}
// -------------------------------------------------------- Private Methods
/**
* Calculate and return an absolute pathname to the XML file to contain
* our persistent storage information.
*
* @throws Exception if an input/output error occurs
*/
private String calculatePath() throws Exception {
// Can we access the database via file I/O?
String path = servlet.getServletContext().getRealPath(pathname);
if (path != null) {
return (path);
}
// Does a copy of this file already exist in our temporary directory
File dir = (File)
servlet.getServletContext().getAttribute
("jakarta.servlet.context.tempdir");
File file = new File(dir, "struts-example-database.xml");
if (file.exists()) {
return (file.getAbsolutePath());
}
// Copy the static resource to a temporary file and return its path
try (BufferedInputStream bis = new BufferedInputStream(
servlet.getServletContext().getResourceAsStream(pathname), 1024);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), 1024)) {
byte buffer[] = new byte[1024];
while (true) {
int n = bis.read(buffer);
if (n <= 0) {
break;
}
bos.write(buffer, 0, n);
}
}
return (file.getAbsolutePath());
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/SaveRegistrationAction.java | Struts Apps - Faces Example 1 | 124 |
| org/apache/struts/webapp/example2/SaveRegistrationAction.java | Struts Apps - Faces Example 2 | 125 |
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.transaction.token"));
}
resetToken(request);
// Validate the request parameters specified by the user
LOG.trace(" Performing extra validations");
String value = null;
value = regform.getUsername();
if (("Create".equals(action)) &&
(database.findUser(value) != null)) {
errors.add("username",
new ActionMessage("error.username.unique",
regform.getUsername()));
}
if ("Create".equals(action)) {
value = regform.getPassword();
if ((value == null) || (value.length() <1)) {
errors.add("password",
new ActionMessage("error.password.required"));
}
value = regform.getPassword2();
if ((value == null) || (value.length() < 1)) {
errors.add("password2",
new ActionMessage("error.password2.required"));
}
}
// Report any errors we have discovered back to the original form
if (!errors.isEmpty()) {
saveErrors(request, errors);
saveToken(request);
return (mapping.getInputForward());
}
// Update the user's persistent profile information
try {
if ("Create".equals(action)) {
user = database.createUser(regform.getUsername());
}
String oldPassword = user.getPassword();
PropertyUtils.copyProperties(user, regform);
if ((regform.getPassword() == null) ||
(regform.getPassword().length() < 1)) {
user.setPassword(oldPassword);
}
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null) {
t = e;
}
LOG.error("Registration.populate", t);
throw new ServletException("Registration.populate", t);
} catch (Throwable t) {
LOG.error("Registration.populate", t);
throw new ServletException("Subscription.populate", t);
}
try {
database.save();
} catch (Exception e) {
LOG.error("Database save", e);
}
// Log the user in if appropriate
if ("Create".equals(action)) {
session.setAttribute(Constants.USER_KEY, user);
LOG.trace(" User '{}' logged on in session {}",
user.getUsername(), session.getId());
}
// Remove the obsolete form bean
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
// Forward control to the specified success URI
LOG.trace(" Forwarding to success page");
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/SubscriptionForm.java | Struts Apps - Faces Example 1 | 60 |
| org/apache/struts/webapp/example2/SubscriptionForm.java | Struts Apps - Faces Example 2 | 60 |
private String action = "Create";
/**
* Should we auto-connect at startup time?
*/
private boolean autoConnect = false;
/**
* The host name.
*/
private String host = null;
/**
* The password.
*/
private String password = null;
/**
* The subscription type.
*/
private String type = null;
/**
* The username.
*/
private String username = null;
// ----------------------------------------------------------- Properties
/**
* Return the maintenance action.
*/
public String getAction() {
return (this.action);
}
/**
* Set the maintenance action.
*
* @param action The new maintenance action.
*/
public void setAction(String action) {
this.action = action;
}
/**
* Return the auto-connect flag.
*/
public boolean getAutoConnect() {
return (this.autoConnect);
}
/**
* Set the auto-connect flag.
*
* @param autoConnect The new auto-connect flag
*/
public void setAutoConnect(boolean autoConnect) {
this.autoConnect = autoConnect;
}
/**
* Return the host name.
*/
public String getHost() {
return (this.host);
}
/**
* Set the host name.
*
* @param host The host name
*/
public void setHost(String host) {
this.host = host;
}
/**
* Return the password.
*/
public String getPassword() {
return (this.password);
}
/**
* Set the password.
*
* @param password The new password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Return the subscription type.
*/
public String getType() {
return (this.type);
}
/**
* Set the subscription type.
*
* @param type The subscription type
*/
public void setType(String type) {
this.type = type;
}
/**
* Return the username.
*/
public String getUsername() {
return (this.username);
}
/**
* Set the username.
*
* @param username The new username
*/
public void setUsername(String username) {
this.username = username;
}
// --------------------------------------------------------- Public Methods
/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.action = "Create";
this.autoConnect = false;
this.host = null;
this.password = null;
this.type = null;
this.username = null;
}
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionMessages</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionMessages</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((host == null) || (host.length() < 1))
errors.add("host",
new ActionMessage("error.host.required"));
if ((username == null) || (username.length() < 1))
errors.add("username",
new ActionMessage("error.username.required"));
if ((password == null) || (password.length() < 1))
errors.add("password",
new ActionMessage("error.password.required"));
if ((type == null) || (type.length() < 1))
errors.add("type",
new ActionMessage("error.type.required"));
else if (!"imap".equals(type) && !"pop3".equals(type))
errors.add("type",
new ActionMessage("error.type.invalid", type));
return (errors);
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/apps/mailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Mailreader | 59 |
| org/apache/struts/apps/scriptingmailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Scripting Mailreader | 59 |
public final class MemoryDatabasePlugIn implements PlugIn {
// ----------------------------------------------------- Instance Variables
/**
* The {@link MemoryUserDatabase} object we construct and make available.
*/
private MemoryUserDatabase database = null;
/**
* The {@code Log} instance for this class.
*/
private final static Logger LOG =
LoggerFactory.getLogger(MemoryDatabasePlugIn.class);
/**
* The {@link ActionServlet} owning this application.
*/
private ActionServlet servlet = null;
// ------------------------------------------------------------- Properties
/**
* The web application resource path of our persistent database
* storage file.
*/
private String pathname = "/WEB-INF/database.xml";
public String getPathname() {
return (this.pathname);
}
public void setPathname(String pathname) {
this.pathname = pathname;
}
// --------------------------------------------------------- PlugIn Methods
/**
* Gracefully shut down this database, releasing any resources
* that were allocated at initialization.
*/
public void destroy() {
LOG.info("Finalizing memory database plug in");
if (database != null) {
try {
database.close();
} catch (Exception e) {
LOG.error("Closing memory database", e);
}
}
servlet.getServletContext().removeAttribute(Constants.DATABASE_KEY);
database = null;
servlet = null;
database = null;
}
/**
* Initialize and load our initial database from persistent storage.
*
* @param servlet The ActionServlet for this web application
* @param config The ApplicationConfig for our owning module
*
* @throws ServletException if we cannot configure ourselves correctly
*/
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
LOG.info("Initializing memory database plug in from '{}'",
pathname);
// Remember our associated configuration and servlet
this.servlet = servlet;
// Construct a new database and make it available
database = new MemoryUserDatabase();
try {
String path = calculatePath();
LOG.debug(" Loading database from '{}'", path);
database.setPathname(path);
database.open();
} catch (Exception e) {
LOG.error("Opening memory database", e);
throw new ServletException("Cannot load database from '" +
pathname + "'", e);
}
// Make the initialized database available
servlet.getServletContext().setAttribute(Constants.DATABASE_KEY,
database);
}
// --------------------------------------------------------- Public Methods
// -------------------------------------------------------- Private Methods
/**
* Calculate and return an absolute pathname to the XML file to contain
* our persistent storage information.
*
* @throws Exception if an input/output error occurs
*/
private String calculatePath() throws Exception {
// Can we access the database via file I/O?
String path = servlet.getServletContext().getRealPath(pathname);
if (path != null) {
return (path);
}
// Does a copy of this file already exist in our temporary directory
File dir = (File)
servlet.getServletContext().getAttribute
("jakarta.servlet.context.tempdir");
File file = new File(dir, "struts-example-database.xml");
if (file.exists()) {
return (file.getAbsolutePath());
}
// Copy the static resource to a temporary file and return its path
try (BufferedInputStream bis = new BufferedInputStream(
servlet.getServletContext().getResourceAsStream(pathname), 1024);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), 1024)) {
byte buffer[] = new byte[1024];
while (true) {
int n = bis.read(buffer);
if (n <= 0) {
break;
}
bos.write(buffer, 0, n);
}
}
return (file.getAbsolutePath());
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/EditSubscriptionAction.java | Struts Apps - Faces Example 1 | 62 |
| org/apache/struts/webapp/example2/EditSubscriptionAction.java | Struts Apps - Faces Example 2 | 62 |
private final static Logger LOG =
LoggerFactory.getLogger(EditSubscriptionAction.class);
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Extract attributes we will need
HttpSession session = request.getSession();
String action = request.getParameter("action");
if (action == null) {
action = "Create";
}
String host = request.getParameter("host");
LOG.debug("EditSubscriptionAction: Processing {} action",
action);
// Is there a currently logged on user?
User user = (User) session.getAttribute(Constants.USER_KEY);
if (user == null) {
LOG.trace(" User is not logged on in session {}",
session.getId());
return (mapping.findForward("logon"));
}
// Identify the relevant subscription
Subscription subscription =
user.findSubscription(request.getParameter("host"));
if ((subscription == null) && !action.equals("Create")) {
LOG.trace(" No subscription for user {} and host {}",
user.getUsername(), host);
return (mapping.findForward("failure"));
}
if (subscription != null) {
session.setAttribute(Constants.SUBSCRIPTION_KEY, subscription);
}
// Populate the subscription form
if (form == null) {
LOG.trace(" Creating new SubscriptionForm bean under key {}",
mapping.getAttribute());
form = new SubscriptionForm();
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), form);
} else {
session.setAttribute(mapping.getAttribute(), form);
}
}
SubscriptionForm subform = (SubscriptionForm) form;
subform.setAction(action);
if (!action.equals("Create")) {
LOG.trace(" Populating form from {}", subscription);
try {
PropertyUtils.copyProperties(subform, subscription);
subform.setAction(action);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null)
t = e;
LOG.error("SubscriptionForm.populate", t);
throw new ServletException("SubscriptionForm.populate", t);
} catch (Throwable t) {
LOG.error("SubscriptionForm.populate", t);
throw new ServletException("SubscriptionForm.populate", t);
}
}
// Forward control to the edit subscription page
LOG.trace(" Forwarding to 'success' page");
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/LinkUserTag.java | Struts Apps - Faces Example 1 | 57 |
| org/apache/struts/webapp/example2/LinkUserTag.java | Struts Apps - Faces Example 2 | 57 |
protected String page = null;
/**
* The message resources for this package.
*/
protected static MessageResources messages =
MessageResources.getMessageResources
("org.apache.struts.webapp.example.ApplicationResources");
/**
* The attribute name.
*/
private String name = "user";
// ------------------------------------------------------------- Properties
/**
* Return the hyperlink URI.
*/
public String getPage() {
return (this.page);
}
/**
* Set the hyperlink URI.
*
* @param page Set the hyperlink URI
*/
public void setPage(String page) {
this.page = page;
}
/**
* Return the attribute name.
*/
public String getName() {
return (this.name);
}
/**
* Set the attribute name.
*
* @param name The new attribute name
*/
public void setName(String name) {
this.name = name;
}
// --------------------------------------------------------- Public Methods
/**
* Render the beginning of the hyperlink.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
// Generate the URL to be encoded
HttpServletRequest request =
(HttpServletRequest) pageContext.getRequest();
StringBuilder url = new StringBuilder(request.getContextPath());
url.append(page);
User user = null;
try {
user = (User) pageContext.findAttribute(name);
} catch (ClassCastException e) {
user = null;
}
if (user == null)
throw new JspException
(messages.getMessage("linkUser.noUser", name));
if (page.indexOf("?") < 0)
url.append("?");
else
url.append("&");
url.append("username=");
url.append(ResponseUtils.filter(user.getUsername()));
// Generate the hyperlink start element
HttpServletResponse response =
(HttpServletResponse) pageContext.getResponse();
StringBuilder results = new StringBuilder("<a href=\"");
results.append(response.encodeURL(url.toString()));
results.append("\">");
// Print this element to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.print(results.toString());
} catch (IOException e) {
throw new JspException
(messages.getMessage("linkUser.io", e.toString()));
}
// Evaluate the body of this tag
return (EVAL_BODY_INCLUDE);
}
/**
* Render the end of the hyperlink.
*
* @exception JspException if a JSP exception has occurred
*/
public int doEndTag() throws JspException {
// Print the ending element to our output writer
JspWriter writer = pageContext.getOut();
try {
writer.print("</a>");
} catch (IOException e) {
throw new JspException
(messages.getMessage("link.io", e.toString()));
}
return (EVAL_PAGE);
}
/**
* Release any acquired resources.
*/
public void release() {
super.release();
this.page = null;
this.name = "user";
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/RegistrationForm.java | Struts Apps - Faces Example 1 | 67 |
| org/apache/struts/webapp/example2/RegistrationForm.java | Struts Apps - Faces Example 2 | 66 |
private String action = "Create";
/**
* The from address.
*/
private String fromAddress = null;
/**
* The full name.
*/
private String fullName = null;
/**
* The password.
*/
private String password = null;
/**
* The confirmation password.
*/
private String password2 = null;
/**
* The reply to address.
*/
private String replyToAddress = null;
/**
* The username.
*/
private String username = null;
// ----------------------------------------------------------- Properties
/**
* Return the maintenance action.
*/
public String getAction() {
return (this.action);
}
/**
* Set the maintenance action.
*
* @param action The new maintenance action.
*/
public void setAction(String action) {
this.action = action;
}
/**
* Return the from address.
*/
public String getFromAddress() {
return (this.fromAddress);
}
/**
* Set the from address.
*
* @param fromAddress The new from address
*/
public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress;
}
/**
* Return the full name.
*/
public String getFullName() {
return (this.fullName);
}
/**
* Set the full name.
*
* @param fullName The new full name
*/
public void setFullName(String fullName) {
this.fullName = fullName;
}
/**
* Return the password.
*/
public String getPassword() {
return (this.password);
}
/**
* Set the password.
*
* @param password The new password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Return the confirmation password.
*/
public String getPassword2() {
return (this.password2);
}
/**
* Set the confirmation password.
*
* @param password2 The new confirmation password
*/
public void setPassword2(String password2) {
this.password2 = password2;
}
/**
* Return the reply to address.
*/
public String getReplyToAddress() {
return (this.replyToAddress);
}
/**
* Set the reply to address.
*
* @param replyToAddress The new reply to address
*/
public void setReplyToAddress(String replyToAddress) {
this.replyToAddress = replyToAddress;
}
/**
* Return the username.
*/
public String getUsername() {
return (this.username);
}
/**
* Set the username.
*
* @param username The new username
*/
public void setUsername(String username) {
this.username = username;
}
// --------------------------------------------------------- Public Methods
/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.action = "Create";
this.fromAddress = null;
this.fullName = null;
this.password = null;
this.password2 = null;
this.replyToAddress = null;
this.username = null;
}
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionMessages</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionMessages</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// Perform validator framework validations
ActionErrors errors = super.validate(mapping, request);
// Only need crossfield validations here
if (((password == null) && (password2 != null)) ||
((password != null) && (password2 == null)) ||
((password != null) && (password2 != null) &&
!password.equals(password2))) {
errors.add("password2",
new ActionMessage("error.password.match"));
}
return errors;
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/LinkTag.java | Struts Taglib | 191 |
| org/apache/struts/taglib/logic/RedirectTag.java | Struts Taglib | 155 |
}
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
public String getPage() {
return (this.page);
}
public void setPage(String page) {
this.page = page;
}
public String getAction() {
return (this.action);
}
public void setAction(String action) {
this.action = action;
}
public String getModule() {
return (this.module);
}
public void setModule(String module) {
this.module = module;
}
public String getParamId() {
return (this.paramId);
}
public void setParamId(String paramId) {
this.paramId = paramId;
}
public String getParamName() {
return (this.paramName);
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamProperty() {
return (this.paramProperty);
}
public void setParamProperty(String paramProperty) {
this.paramProperty = paramProperty;
}
public String getParamScope() {
return (this.paramScope);
}
public void setParamScope(String paramScope) {
this.paramScope = paramScope;
}
public String getProperty() {
return (this.property);
}
public void setProperty(String property) {
this.property = property;
}
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
public String getTarget() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/EditRegistrationAction.java | Struts Apps - Faces Example 1 | 95 |
| org/apache/struts/webapp/example2/EditRegistrationAction.java | Struts Apps - Faces Example 2 | 96 |
LOG.debug("EditRegistrationAction: Processing {} action",
action);
// Is there a currently logged on user?
User user = null;
if (!"Create".equals(action)) {
user = (User) session.getAttribute(Constants.USER_KEY);
if (user == null) {
LOG.debug(" User is not logged on in session {}",
session.getId());
return (mapping.findForward("logon"));
}
}
// Populate the user registration form
if (form == null) {
LOG.trace(" Creating new RegistrationForm bean under key {}",
mapping.getAttribute());
form = new RegistrationForm();
if ("request".equals(mapping.getScope()))
request.setAttribute(mapping.getAttribute(), form);
else
session.setAttribute(mapping.getAttribute(), form);
}
RegistrationForm regform = (RegistrationForm) form;
if (user != null) {
LOG.trace(" Populating form from {}", user);
try {
PropertyUtils.copyProperties(regform, user);
regform.setAction(action);
regform.setPassword(null);
regform.setPassword2(null);
} catch (InvocationTargetException e) {
Throwable t = e.getTargetException();
if (t == null)
t = e;
LOG.error("RegistrationForm.populate", t);
throw new ServletException("RegistrationForm.populate", t);
} catch (Throwable t) {
LOG.error("RegistrationForm.populate", t);
throw new ServletException("RegistrationForm.populate", t);
}
}
// Set a transactional control token to prevent double posting
LOG.trace(" Setting transactional control token");
saveToken(request);
// Forward control to the edit user registration page
LOG.trace(" Forwarding to 'success' page"); | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/tiles/TilesRequestProcessor.java | Struts Tiles | 273 |
| org/apache/struts/tiles2/TilesRequestProcessor.java | Struts Tiles 2 integration | 139 |
}
/**
* Do a forward using request dispatcher.
* Uri is a valid uri. If response has already been commited, do an include
* instead.
* @param uri Uri or Definition name to forward.
* @param request Current page request.
* @param response Current page response.
*/
protected void doForward(
String uri,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
if (response.isCommitted()) {
this.doInclude(uri, request, response);
} else {
super.doForward(uri, request, response);
}
}
/**
* Overloaded method from Struts' RequestProcessor.
* Forward or redirect to the specified destination by the specified
* mechanism.
* This method catches the Struts' actionForward call. It checks if the
* actionForward is done on a Tiles definition name. If true, process the
* definition and insert it. If false, call the original parent's method.
* @param request The servlet request we are processing.
* @param response The servlet response we are creating.
* @param forward The ActionForward controlling where we go next.
*
* @exception IOException if an input/output error occurs.
* @exception ServletException if a servlet exception occurs.
*/
protected void processForwardConfig(
HttpServletRequest request,
HttpServletResponse response,
ForwardConfig forward)
throws IOException, ServletException {
// Required by struts contract
if (forward == null) {
return;
}
log.debug("processForwardConfig({})", forward.getPath());
// Try to process the definition.
if (processTilesDefinition(forward.getPath(),
request, response)) {
log.debug(" '{}' - processed as definition", forward.getPath());
return;
}
log.debug(" '{}' - processed as uri", forward.getPath());
// forward doesn't contain a definition, let parent do processing
super.processForwardConfig(request, response, forward);
}
/**
* Catch the call to a module relative forward.
* If the specified uri is a tiles definition name, insert it.
* Otherwise, parent processing is called.
* Do a module relative forward to specified uri using request dispatcher.
* Uri is relative to the current module. The real uri is computed by
* prefixing the module name.
* <strong>This method is used internally and is not part of the public
* API. It is advised to not use it in subclasses.</strong>
* @param uri Module-relative URI to forward to.
* @param request Current page request.
* @param response Current page response.
* @since Struts 1.1
*/
protected void internalModuleRelativeForward(
String uri,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
if (processTilesDefinition(uri, request, response)) {
return;
}
super.internalModuleRelativeForward(uri, request, response);
}
/**
* Do a module relative include to specified uri using request dispatcher.
* Uri is relative to the current module. The real uri is computed by
* prefixing the module name.
* <strong>This method is used internally and is not part of the public
* API. It is advised to not use it in subclasses.</strong>
* @param uri Module-relative URI to forward to.
* @param request Current page request.
* @param response Current page response.
* @since Struts 1.1
*/
protected void internalModuleRelativeInclude(
String uri,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
if (processTilesDefinition(uri, request, response)) {
return;
}
super.internalModuleRelativeInclude(uri, request, response);
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 1 | 61 |
| org/apache/struts/webapp/example2/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 2 | 61 |
| org/apache/struts/apps/mailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Mailreader | 59 |
| org/apache/struts/apps/scriptingmailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Scripting Mailreader | 59 |
public final class MemoryDatabasePlugIn implements PlugIn {
// ----------------------------------------------------- Instance Variables
/**
* The {@link MemoryUserDatabase} object we construct and make available.
*/
private MemoryUserDatabase database = null;
/**
* The {@code Log} instance for this class.
*/
private final static Logger LOG =
LoggerFactory.getLogger(MemoryDatabasePlugIn.class);
/**
* The {@link ActionServlet} owning this application.
*/
private ActionServlet servlet = null;
// ------------------------------------------------------------- Properties
/**
* The web application resource path of our persistent database
* storage file.
*/
private String pathname = "/WEB-INF/database.xml";
public String getPathname() {
return (this.pathname);
}
public void setPathname(String pathname) {
this.pathname = pathname;
}
// --------------------------------------------------------- PlugIn Methods
/**
* Gracefully shut down this database, releasing any resources
* that were allocated at initialization.
*/
public void destroy() {
LOG.info("Finalizing memory database plug in");
if (database != null) {
try {
database.close();
} catch (Exception e) {
LOG.error("Closing memory database", e);
}
}
servlet.getServletContext().removeAttribute(Constants.DATABASE_KEY);
database = null;
servlet = null;
database = null;
}
/**
* Initialize and load our initial database from persistent storage.
*
* @param servlet The ActionServlet for this web application
* @param config The ApplicationConfig for our owning module
*
* @throws ServletException if we cannot configure ourselves correctly
*/
public void init(ActionServlet servlet, ModuleConfig config)
throws ServletException {
LOG.info("Initializing memory database plug in from '{}'",
pathname);
// Remember our associated configuration and servlet
this.servlet = servlet;
// Construct a new database and make it available
database = new MemoryUserDatabase();
try {
String path = calculatePath();
LOG.debug(" Loading database from '{}'", path);
database.setPathname(path);
database.open();
} catch (Exception e) {
LOG.error("Opening memory database", e);
throw new ServletException("Cannot load database from '" +
pathname + "'", e);
}
// Make the initialized database available
servlet.getServletContext().setAttribute(Constants.DATABASE_KEY,
database); | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/ImgTag.java | Struts Taglib | 255 |
| org/apache/struts/taglib/html/LinkTag.java | Struts Taglib | 207 |
}
public String getAction() {
return (this.action);
}
public void setAction(String action) {
this.action = action;
}
public String getModule() {
return (this.module);
}
public void setModule(String module) {
this.module = module;
}
public String getParamId() {
return (this.paramId);
}
public void setParamId(String paramId) {
this.paramId = paramId;
}
public String getParamName() {
return (this.paramName);
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamProperty() {
return (this.paramProperty);
}
public void setParamProperty(String paramProperty) {
this.paramProperty = paramProperty;
}
public String getParamScope() {
return (this.paramScope);
}
public void setParamScope(String paramScope) {
this.paramScope = paramScope;
}
public String getProperty() {
return (this.property);
}
public void setProperty(String property) {
this.property = property;
}
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
public String getSrc() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/ImgTag.java | Struts Taglib | 255 |
| org/apache/struts/taglib/logic/RedirectTag.java | Struts Taglib | 171 |
}
public String getAction() {
return (this.action);
}
public void setAction(String action) {
this.action = action;
}
public String getModule() {
return (this.module);
}
public void setModule(String module) {
this.module = module;
}
public String getParamId() {
return (this.paramId);
}
public void setParamId(String paramId) {
this.paramId = paramId;
}
public String getParamName() {
return (this.paramName);
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamProperty() {
return (this.paramProperty);
}
public void setParamProperty(String paramProperty) {
this.paramProperty = paramProperty;
}
public String getParamScope() {
return (this.paramScope);
}
public void setParamScope(String paramScope) {
this.paramScope = paramScope;
}
public String getProperty() {
return (this.property);
}
public void setProperty(String property) {
this.property = property;
}
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
public String getSrc() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/el/exercise/TestBean.java | Struts Apps - EL Examples | 253 |
| org/apache/struts/webapp/exercise/TestBean.java | Struts Apps - Examples | 253 |
return (nested);
}
/**
* A String property with an initial value of null.
*/
private String nullProperty = null;
public String getNullProperty() {
return (this.nullProperty);
}
public void setNullProperty(String nullProperty) {
this.nullProperty = nullProperty;
}
/**
* A short property.
*/
private short shortProperty = (short) 987;
public short getShortProperty() {
return (this.shortProperty);
}
public void setShortProperty(short shortProperty) {
this.shortProperty = shortProperty;
}
/**
* A single-String value for a SELECT element.
*/
private String singleSelect = "Single 5";
public String getSingleSelect() {
return (this.singleSelect);
}
public void setSingleSelect(String singleSelect) {
this.singleSelect = singleSelect;
}
/**
* String arrays that are accessed as an array as well as indexed.
*/
private String stringArray[] =
{ "String 0", "String 1", "String 2", "String 3", "String 4" };
public String[] getStringArray() {
return (this.stringArray);
}
public void setStringArray(String stringArray[]) {
this.stringArray = stringArray;
}
private String stringIndexed[] =
{ "String 0", "String 1", "String 2", "String 3", "String 4" };
public String getStringIndexed(int index) {
return (stringIndexed[index]);
}
public void setStringIndexed(int index, String value) {
stringIndexed[index] = value;
}
private String indexedStrings[] = | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/CheckLogonTag.java | Struts Apps - Faces Example 1 | 50 |
| org/apache/struts/webapp/example2/CheckLogonTag.java | Struts Apps - Faces Example 2 | 50 |
private String name = Constants.USER_KEY;
/**
* The page to which we should forward for the user to log on.
*/
private String page = "/logon.jsp";
// ----------------------------------------------------------- Properties
/**
* Return the bean name.
*/
public String getName() {
return (this.name);
}
/**
* Set the bean name.
*
* @param name The new bean name
*/
public void setName(String name) {
this.name = name;
}
/**
* Return the forward page.
*/
public String getPage() {
return (this.page);
}
/**
* Set the forward page.
*
* @param page The new forward page
*/
public void setPage(String page) {
this.page = page;
}
// ------------------------------------------------------- Public Methods
/**
* Defer our checking until the end of this tag is encountered.
*
* @exception JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
return (SKIP_BODY);
}
/**
* Perform our logged-in user check by looking for the existence of
* a session scope bean under the specified name. If this bean is not
* present, control is forwarded to the specified logon page.
*
* @exception JspException if a JSP exception has occurred
*/
public int doEndTag() throws JspException {
// Is there a valid user logged on?
boolean valid = false;
HttpSession session = pageContext.getSession();
if ((session != null) && (session.getAttribute(name) != null))
valid = true;
// Forward control based on the results
if (valid)
return (EVAL_PAGE);
else {
try {
pageContext.forward(page);
} catch (Exception e) {
throw new JspException(e.toString());
}
return (SKIP_PAGE);
}
}
/**
* Release any acquired resources.
*/
public void release() {
super.release();
this.name = Constants.USER_KEY;
this.page = "/logon.jsp";
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/LogonAction.java | Struts Apps - Faces Example 1 | 108 |
| org/apache/struts/webapp/example2/LogonAction.java | Struts Apps - Faces Example 2 | 108 |
errors.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("error.password.mismatch"));
}
// Report any errors we have discovered back to the original form
if (!errors.isEmpty()) {
saveErrors(request, errors);
return (mapping.getInputForward());
}
// Save our logged-in user in the session
HttpSession session = request.getSession();
session.setAttribute(Constants.USER_KEY, user);
LOG.debug("LogonAction: User '{}' logged on in session {}",
user.getUsername(), session.getId());
// Remove the obsolete form bean
if (mapping.getAttribute() != null) {
if ("request".equals(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
// Forward control to the specified success URI
return (mapping.findForward("success"));
}
// ------------------------------------------------------ Protected Methods
/**
* Look up the user, throwing an exception to simulate business logic
* rule exceptions.
*
* @param database Database in which to look up the user
* @param username Username specified on the logon form
*
* @throws ModuleException if a business logic rule is violated
*/
public User getUser(UserDatabase database, String username)
throws ModuleException {
// Force an ArithmeticException which can be handled explicitly
if ("arithmetic".equals(username)) {
throw new ArithmeticException();
}
// Force an application-specific exception which can be handled
if ("expired".equals(username)) {
throw new ExpiredPasswordException(username);
}
// Look up and return the specified user
return (database.findUser(username));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/SaveRegistrationAction.java | Struts Apps - Faces Example 1 | 65 |
| org/apache/struts/webapp/example2/SaveRegistrationAction.java | Struts Apps - Faces Example 2 | 65 |
private final static Logger LOG =
LoggerFactory.getLogger(SaveRegistrationAction.class);
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if the application business logic throws
* an exception
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Extract attributes and parameters we will need
HttpSession session = request.getSession();
RegistrationForm regform = (RegistrationForm) form;
String action = regform.getAction();
if (action == null) {
action = "Create";
}
UserDatabase database = (UserDatabase)
servlet.getServletContext().getAttribute(Constants.DATABASE_KEY);
LOG.debug("SaveRegistrationAction: Processing {} action",
action);
// Is there a currently logged on user (unless creating)?
User user = (User) session.getAttribute(Constants.USER_KEY);
if (!"Create".equals(action) && (user == null)) {
LOG.trace(" User is not logged on in session {}",
session.getId());
return (mapping.findForward("logon"));
}
// Was this transaction cancelled?
if (isCancelled(request)) {
LOG.trace(" Transaction '{}' was cancelled", action);
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
return (mapping.findForward("failure"));
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/OptionsCollectionTag.java | Struts Taglib | 310 |
| org/apache/struts/taglib/html/OptionsTag.java | Struts Taglib | 319 |
protected void addOption(StringBuilder sb, String label, String value,
boolean matched) {
sb.append("<option value=\"");
if (filter) {
sb.append(TagUtils.getInstance().filter(value));
} else {
sb.append(value);
}
sb.append("\"");
if (matched) {
sb.append(" selected=\"selected\"");
}
if (style != null) {
sb.append(" style=\"");
sb.append(TagUtils.getInstance().filter(style));
sb.append("\"");
}
if (styleClass != null) {
sb.append(" class=\"");
sb.append(TagUtils.getInstance().filter(styleClass));
sb.append("\"");
}
sb.append(">");
if (filter) {
sb.append(TagUtils.getInstance().filter(label));
} else {
sb.append(label);
}
sb.append("</option>\r\n");
}
/**
* Return an iterator for the options collection.
*
* @param collection Collection to be iterated over
* @throws JspException if an error occurs
*/
protected Iterator<?> getIterator(Object collection) | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/extras/actions/ActionDispatcher.java | Struts Extras | 368 |
| org/apache/struts/extras/actions/DispatchAction.java | Struts Extras | 273 |
forward = (ActionForward) method.invoke(actionInstance, args);
} catch (ClassCastException e) {
log.atError()
.setMessage(() -> messages.getMessage("dispatch.return", mapping.getPath(), name))
.setCause(e).log();
throw e;
} catch (IllegalAccessException e) {
log.atError()
.setMessage(() -> messages.getMessage("dispatch.error", mapping.getPath(), name))
.setCause(e).log();
throw e;
} catch (InvocationTargetException e) {
// Rethrow the target exception if possible so that the
// exception handling machinery can deal with it
Throwable t = e.getTargetException();
if (t instanceof Exception) {
throw ((Exception) t);
} else {
log.atError()
.setMessage(() -> messages.getMessage("dispatch.error", mapping.getPath(),
name))
.setCause(e).log();
throw new ServletException(t);
}
}
// Return the returned ActionForward instance
return (forward);
}
/**
* Introspect the current class to identify a method of the specified name
* that accepts the same parameter types as the <code>execute</code>
* method does.
*
* @param name Name of the method to be introspected
* @return The method with the specified name.
* @throws NoSuchMethodException if no such method can be found
*/
protected Method getMethod(String name) | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 1 | 189 |
| org/apache/struts/webapp/example2/plugin/MemoryDatabasePlugIn.java | Struts Apps - Faces Example 2 | 190 |
| org/apache/struts/apps/mailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Mailreader | 160 |
| org/apache/struts/apps/scriptingmailreader/plugin/MemoryDatabasePlugIn.java | Struts Apps - Scripting Mailreader | 160 |
servlet.getServletContext().setAttribute("serverTypes", serverTypes);
}
// -------------------------------------------------------- Private Methods
/**
* Calculate and return an absolute pathname to the XML file to contain
* our persistent storage information.
*
* @throws Exception if an input/output error occurs
*/
private String calculatePath() throws Exception {
// Can we access the database via file I/O?
String path = servlet.getServletContext().getRealPath(pathname);
if (path != null) {
return (path);
}
// Does a copy of this file already exist in our temporary directory
File dir = (File)
servlet.getServletContext().getAttribute
("jakarta.servlet.context.tempdir");
File file = new File(dir, "struts-example-database.xml");
if (file.exists()) {
return (file.getAbsolutePath());
}
// Copy the static resource to a temporary file and return its path
try (BufferedInputStream bis = new BufferedInputStream(
servlet.getServletContext().getResourceAsStream(pathname), 1024);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file), 1024)) {
byte buffer[] = new byte[1024];
while (true) {
int n = bis.read(buffer);
if (n <= 0) {
break;
}
bos.write(buffer, 0, n);
}
}
return (file.getAbsolutePath());
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/faces/application/FacesRequestProcessor.java | Struts Faces | 377 |
| org/apache/struts/faces/application/FacesTilesRequestProcessor.java | Struts Faces | 443 |
return (result);
}
// --------------------------------------------------------- Private Methods
/**
* <p>Return the used Lifecycle ID (default or custom).</p>
*/
private String getLifecycleId()
{
String lifecycleId = this.servlet.getServletContext().getInitParameter(LIFECYCLE_ID_ATTR);
return lifecycleId != null ? lifecycleId : LifecycleFactory.DEFAULT_LIFECYCLE;
}
/**
* <p>Return <code>true</code> if the specified context-relative URI
* specifies a request to be processed by the Struts controller servlet.</p>
*
* @param uri URI to be checked
*/
private boolean isStrutsRequest(String uri) {
int question = uri.indexOf("?");
if (question >= 0) {
uri = uri.substring(0, question);
}
String mapping = (String)
servlet.getServletContext().getAttribute(Globals.SERVLET_KEY);
if (mapping == null) {
return (false);
} else if (mapping.startsWith("*.")) {
return (uri.endsWith(mapping.substring(1)));
} else if (mapping.endsWith("/*")) {
return (uri.startsWith(mapping.substring(0, mapping.length() - 2)));
} else {
return (false);
}
}
} | ||
| File | Project | Line |
|---|---|---|
| examples/TestBean.java | Struts Apps - Cookbook | 66 |
| examples/bean/ExampleBean.java | Struts Apps - Cookbook | 81 |
public TestBean() {
super();
}
// -------------------------------------------------------------- Properties
/**
* Returns the booleanValue.
* @return boolean
*/
public boolean isBooleanValue() {
return booleanValue;
}
/**
* Returns the doubleValue.
* @return double
*/
public double getDoubleValue() {
return doubleValue;
}
/**
* Returns the floatValue.
* @return float
*/
public float getFloatValue() {
return floatValue;
}
/**
* Returns the intValue.
* @return int
*/
public int getIntValue() {
return intValue;
}
/**
* Returns the longValue.
* @return long
*/
public long getLongValue() {
return longValue;
}
/**
* Returns the shortValue.
* @return short
*/
public short getShortValue() {
return shortValue;
}
/**
* Returns the stringValue.
* @return String
*/
public String getStringValue() {
return stringValue;
}
/**
* Sets the booleanValue.
* @param booleanValue The booleanValue to set
*/
public void setBooleanValue(boolean booleanValue) {
this.booleanValue = booleanValue;
}
/**
* Sets the doubleValue.
* @param doubleValue The doubleValue to set
*/
public void setDoubleValue(double doubleValue) {
this.doubleValue = doubleValue;
}
/**
* Sets the floatValue.
* @param floatValue The floatValue to set
*/
public void setFloatValue(float floatValue) {
this.floatValue = floatValue;
}
/**
* Sets the intValue.
* @param intValue The intValue to set
*/
public void setIntValue(int intValue) {
this.intValue = intValue;
}
/**
* Sets the longValue.
* @param longValue The longValue to set
*/
public void setLongValue(long longValue) {
this.longValue = longValue;
}
/**
* Sets the shortValue.
* @param shortValue The shortValue to set
*/
public void setShortValue(short shortValue) {
this.shortValue = shortValue;
}
/**
* Sets the stringValue.
* @param stringValue The stringValue to set
*/
public void setStringValue(String stringValue) {
this.stringValue = stringValue;
}
/**
* Returns the dateValue.
* @return java.util.Date
*/
public java.util.Date getDateValue() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/LogonForm.java | Struts Apps - Faces Example 1 | 55 |
| org/apache/struts/webapp/example2/LogonForm.java | Struts Apps - Faces Example 2 | 55 |
private String password = null;
/**
* The username.
*/
private String username = null;
// ----------------------------------------------------------- Properties
/**
* Return the password.
*/
public String getPassword() {
return (this.password);
}
/**
* Set the password.
*
* @param password The new password
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Return the username.
*/
public String getUsername() {
return (this.username);
}
/**
* Set the username.
*
* @param username The new username
*/
public void setUsername(String username) {
this.username = username;
}
// --------------------------------------------------------- Public Methods
/**
* Reset all properties to their default values.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.password = null;
this.username = null;
}
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionMessages</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionMessages</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((username == null) || (username.length() < 1))
errors.add("username", new ActionMessage("error.username.required"));
if ((password == null) || (password.length() < 1))
errors.add("password", new ActionMessage("error.password.required"));
return errors;
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/dispatch/ActionDispatcherExample.java | Struts Apps - Examples | 44 |
| org/apache/struts/webapp/dispatch/EventActionDispatcherExample.java | Struts Apps - Examples | 44 |
ActionDispatcher.DISPATCH_FLAVOR);
private int fooCount;
private int barCount;
/**
* Execute method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return dispatcher.execute(mapping, form, request, response);
}
/**
* Example "foo" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doFoo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
fooCount++;
ActionMessages messages = new ActionMessages();
messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/extras/actions/ActionDispatcher.java | Struts Extras | 180 |
| org/apache/struts/extras/actions/DispatchAction.java | Struts Extras | 126 |
}
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @return The forward to which control should be transferred, or
* <code>null</code> if the response has been completed.
* @throws Exception if an exception occurs
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// Process "cancelled"
if (isCancelled(request)) {
ActionForward af = cancelled(mapping, form, request, response);
if (af != null) {
return af;
}
}
// Identify the request parameter containing the method name
String parameter = getParameter(mapping, form, request, response);
// Get the method's name. This could be overridden in subclasses.
String name =
getMethodName(mapping, form, request, response, parameter);
// Prevent recursive calls
if ("execute".equals(name) || "perform".equals(name)) {
String message =
messages.getMessage("dispatch.recursive", mapping.getPath());
log.error(message);
throw new ServletException(message);
}
// Invoke the named method, and return the result
return dispatchMethod(mapping, form, request, response, name);
}
/**
* <p>Dispatches to the target class' <code>unspecified</code> method, if
* present, otherwise throws a ServletException. Classes utilizing
* <code>ActionDispatcher</code> should provide an <code>unspecified</code>
* method if they wish to provide behavior different than throwing a
* ServletException.</p>
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The non-HTTP request we are processing
* @param response The non-HTTP response we are creating
* @return The forward to which control should be transferred, or
* <code>null</code> if the response has been completed.
* @throws Exception if the application business logic throws an
* exception.
*/
protected ActionForward unspecified(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
// Identify if there is an "unspecified" method to be dispatched to
String name = "unspecified"; | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/extras/actions/EventActionDispatcher.java | Struts Extras | 159 |
| org/apache/struts/extras/actions/EventDispatchAction.java | Struts Extras | 118 |
return dispatchMethod(mapping, form, request, response, name, method);
}
/**
* Returns the method name, given a parameter's value.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if
* any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
* @param parameter The <code>ActionMapping</code> parameter's name
* @return The method's name.
* @throws Exception if an error occurs.
*/
protected String getMethodName(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response,
String parameter) throws Exception {
StringTokenizer st = new StringTokenizer(parameter, ",");
String defaultMethodName = null;
while (st.hasMoreTokens()) {
String methodKey = st.nextToken().trim();
String methodName = methodKey;
// The key can either be a direct method name or an alias
// to a method as indicated by a "key=value" signature
int equals = methodKey.indexOf('=');
if (equals > -1) {
methodName = methodKey.substring(equals + 1).trim();
methodKey = methodKey.substring(0, equals).trim();
}
// Set the default if it passes by
if (methodKey.equals(DEFAULT_METHOD_KEY)) {
defaultMethodName = methodName;
}
// If the method key exists as a standalone parameter or with
// the image suffixes (.x/.y), the method name has been found.
if ((request.getParameter(methodKey) != null)
|| (request.getParameter(methodKey + ".x") != null)) {
return methodName;
}
}
return defaultMethodName;
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/bean/HeaderTag.java | Struts Taglib | 46 |
| org/apache/struts/taglib/bean/ParameterTag.java | Struts Taglib | 42 |
protected static MessageResources messages =
MessageResources.getMessageResources(
"org.apache.struts.taglib.bean.LocalStrings");
// ------------------------------------------------------------- Properties
/**
* The name of the scripting variable that will be exposed as a page scope
* attribute.
*/
protected String id = null;
/**
* Return an array of header values if <code>multiple</code> is non-null.
*/
protected String multiple = null;
/**
* The name of the header whose value is to be exposed.
*/
protected String name = null;
/**
* The default value to return if no header of the specified name is
* found.
*/
protected String value = null;
public String getId() {
return (this.id);
}
public void setId(String id) {
this.id = id;
}
public String getMultiple() {
return (this.multiple);
}
public void setMultiple(String multiple) {
this.multiple = multiple;
}
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return (this.value);
}
public void setValue(String value) {
this.value = value;
}
// --------------------------------------------------------- Public Methods
/**
* Retrieve the required property and expose it as a scripting variable.
*
* @throws JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException {
if (this.multiple == null) { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/faces/component/MessageComponent.java | Struts Faces | 185 |
| org/apache/struts/faces/component/WriteComponent.java | Struts Faces | 119 |
}
/**
* <p>Return the CSS style(s) to be rendered for this component.</p>
*/
public String getStyle() {
ValueExpression vb = getValueExpression("style");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return style;
}
}
/**
* <p>Set the CSS style(s) to be rendered for this component.</p>
*
* @param style The new CSS style(s)
*/
public void setStyle(String style) {
this.style = style;
}
/**
* <p>Return the CSS style class(es) to be rendered for this component.</p>
*/
public String getStyleClass() {
ValueExpression vb = getValueExpression("styleClass");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return styleClass;
}
}
/**
* <p>Set the CSS style class(es) to be rendered for this component.</p>
*
* @param styleClass The new CSS style class(es)
*/
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
// ---------------------------------------------------- StateManager Methods
/**
* <p>Restore the state of this component.</p>
*
* @param context <code>FacesContext</code> for the current request
* @param state State object from which to restore our state
*/
public void restoreState(FacesContext context, Object state) {
Object values[] = (Object[]) state;
super.restoreState(context, values[0]); | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/bean/CookieTag.java | Struts Taglib | 46 |
| org/apache/struts/taglib/bean/HeaderTag.java | Struts Taglib | 46 |
| org/apache/struts/taglib/bean/ParameterTag.java | Struts Taglib | 42 |
protected static MessageResources messages =
MessageResources.getMessageResources(
"org.apache.struts.taglib.bean.LocalStrings");
// ------------------------------------------------------------- Properties
/**
* The name of the scripting variable that will be exposed as a page scope
* attribute.
*/
protected String id = null;
/**
* Return an array of Cookies if <code>multiple</code> is non-null.
*/
protected String multiple = null;
/**
* The name of the cookie whose value is to be exposed.
*/
protected String name = null;
/**
* The default value to return if no cookie of the specified name is
* found.
*/
protected String value = null;
public String getId() {
return (this.id);
}
public void setId(String id) {
this.id = id;
}
public String getMultiple() {
return (this.multiple);
}
public void setMultiple(String multiple) {
this.multiple = multiple;
}
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return (this.value);
}
public void setValue(String value) {
this.value = value;
}
// --------------------------------------------------------- Public Methods
/**
* Retrieve the required property and expose it as a scripting variable.
*
* @throws JspException if a JSP exception has occurred
*/
public int doStartTag() throws JspException { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/OptionsCollectionTag.java | Struts Taglib | 357 |
| org/apache/struts/taglib/html/OptionsTag.java | Struts Taglib | 408 |
if (collection.getClass().isArray()) {
collection = Arrays.asList((Object[]) collection);
}
if (collection instanceof Collection) {
return (((Collection<?>) collection).iterator());
} else if (collection instanceof Iterator) {
return ((Iterator<?>) collection);
} else if (collection instanceof Map) {
return (((Map<?, ?>) collection).entrySet().iterator());
} else if (collection instanceof Enumeration) {
Enumeration<?> enumeration = (Enumeration<?>) collection;
return new IteratorAdapter<>(enumeration);
} else {
throw new JspException(messages.getMessage( | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/apps/mailreader/Constants.java | Struts Apps - Mailreader | 101 |
| org/apache/struts/apps/scriptingmailreader/Constants.java | Struts Apps - Scripting Mailreader | 101 |
public static final String SAVE = "Save";
/**
* <p>
* The session scope attribute under which the Subscription object
* currently selected by our logged-in User is stored.
* </p>
*/
public static final String SUBSCRIPTION_KEY = "subscription";
/**
* <p>
* The token representing a "success" result for this application.
* </p>
*/
public static final String SUCCESS = "Success";
/**
* <p>
* The session scope attribute under which the User object
* for the currently logged in user is stored.
* </p>
*/
public static final String USER_KEY = "user";
// ---- Error Messages ----
/**
* <p>
* A static message in case database resource is not loaded.
* <p>
*/
public static final String ERROR_DATABASE_NOT_LOADED =
"ERROR: User database not loaded -- check servlet container logs for error messages.";
/**
* <p>
* A static message in case message resource is not loaded.
* </p>
*/
public static final String ERROR_MESSAGES_NOT_LOADED =
"ERROR: Message resources not loaded -- check servlet container logs for error messages.";
// ---- Error Tokens ----
/**
* <p>
* The resource key for an error with the transactional token.
* </p>
*/
public static final String MSG_TRANSACTION_TOKEN = "error.transaction.token";
// ---- Log Messages ----
/**
* <p>
* The message to log when cancelling a transaction.
* </p>
*/
public static final String LOG_CANCEL = " Transaction cancelled: ";
/**
* <p>
* The message to log when forwarding to a result.
* </p>
*/
public static final String LOG_RESULT = " Forwarding to result: ";
/**
* <p>
* The message to log when forwarding to a 'failure' result.
* <p>
*/
public static final String LOG_FAILURE = LOG_RESULT + FAILURE;
/**
* <p>
* The message to log when forwarding to a 'logon' result.
* </p>
*/
public static final String LOG_LOGON = LOG_RESULT + LOGON;
/**
* <p>
* The message to log when populating a form.
* </p>
*/
public static final String LOG_POPULATE_FORM = " Populating form from: ";
/**
* <p>
* The message to log when populating a subscription.
* </p>
*/
public static final String LOG_POPULATE_SUBSCRIPTION = " Populating subscription: ";
/**
* <p>
* The message to log when populating a user.
* </p>
*/
public static final String LOG_POPULATE_USER = " Populating user: ";
/**
* <p>
* The message to log when forwarding to a 'success' result.
* </p>
*/
public static final String LOG_PROCESSING = " Processing: ";
/**
* <p>
* The message to log when forwarding to a 'success' result.
* </p>
*/
public static final String LOG_SUCCESS = LOG_RESULT + SUCCESS;
/**
* <p>
* The message to log when setting a transactional token.
* </p>
*/
public static final String LOG_TOKEN = " Setting transactional control token";
/**
* <p>
* The message to log when checking a transactional token.
* </p>
*/
public static final String LOG_TOKEN_CHECK = " Checking transactional control token";
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/extras/actions/ActionDispatcher.java | Struts Extras | 298 |
| org/apache/struts/extras/actions/DispatchAction.java | Struts Extras | 223 |
}
// ----------------------------------------------------- Protected Methods
/**
* Dispatch to the specified method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The non-HTTP request we are processing
* @param response The non-HTTP response we are creating
* @param name The name of the method to invoke
* @return The forward to which control should be transferred, or
* <code>null</code> if the response has been completed.
* @throws Exception if the application business logic throws an
* exception.
*/
protected ActionForward dispatchMethod(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response, String name)
throws Exception {
// Make sure we have a valid method name to call.
// This may be null if the user hacks the query string.
if (name == null) {
return this.unspecified(mapping, form, request, response);
}
// Identify the method object to be dispatched to
Method method = null;
try {
method = getMethod(name);
} catch (NoSuchMethodException e) {
log.atError()
.setMessage(() -> messages.getMessage("dispatch.method", mapping.getPath(), name))
.setCause(e).log();
String userMsg =
messages.getMessage("dispatch.method.user", mapping.getPath());
NoSuchMethodException e2 = new NoSuchMethodException(userMsg);
e2.initCause(e);
throw e2;
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/LogoffAction.java | Struts Apps - Faces Example 1 | 57 |
| org/apache/struts/webapp/example2/LogoffAction.java | Struts Apps - Faces Example 2 | 57 |
private final static Logger LOG =
LoggerFactory.getLogger(LogoffAction.class);
// --------------------------------------------------------- Public Methods
/**
* Process the specified HTTP request, and create the corresponding HTTP
* response (or forward to another web component that will create it).
* Return an <code>ActionForward</code> instance describing where and how
* control should be forwarded, or <code>null</code> if the response has
* already been completed.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request (if any)
* @param request The HTTP request we are processing
* @param response The HTTP response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
// Extract attributes we will need
HttpSession session = request.getSession();
User user = (User) session.getAttribute(Constants.USER_KEY);
// Process this user logoff
if (user != null) {
LOG.debug("LogoffAction: User '{}' logged off in session {}",
user.getUsername(), session.getId());
} else {
LOG.debug("LogoffActon: User logged off in session {}",
session.getId());
}
session.removeAttribute(Constants.SUBSCRIPTION_KEY);
session.removeAttribute(Constants.USER_KEY);
session.invalidate();
// Forward control to the specified success URI
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/dispatch/DispatchExampleAction.java | Struts Apps - Examples | 41 |
| org/apache/struts/webapp/dispatch/EventDispatchActionExample.java | Struts Apps - Examples | 41 |
| org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java | Struts Apps - Examples | 41 |
private int fooCount;
private int barCount;
/**
* Example "foo" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doFoo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
fooCount++;
ActionMessages messages = new ActionMessages();
messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/logic/CompareTagBase.java | Struts Taglib | 146 |
| org/apache/struts/taglib/logic/MatchTag.java | Struts Taglib | 107 |
Object variable = null;
if (cookie != null) {
Cookie[] cookies =
((HttpServletRequest) pageContext.getRequest()).getCookies();
if (cookies == null) {
cookies = new Cookie[0];
}
for (int i = 0; i < cookies.length; i++) {
if (cookie.equals(cookies[i].getName())) {
variable = cookies[i].getValue();
break;
}
}
} else if (header != null) {
variable =
((HttpServletRequest) pageContext.getRequest()).getHeader(header);
} else if (name != null) {
Object bean = | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/tiles/TilesPlugin.java | Struts Tiles | 329 |
| org/apache/struts/tiles2/TilesPlugin.java | Struts Tiles 2 integration | 203 |
}
/**
* Set RequestProcessor to appropriate Tiles {@link RequestProcessor}.
* First, check if a RequestProcessor is specified. If yes, check if it extends
* the appropriate {@link TilesRequestProcessor} class. If not, set processor class to
* TilesRequestProcessor.
*
* @param config ModuleConfig for the module with which
* this plugin is associated.
* @throws ServletException On errors.
*/
protected void initRequestProcessorClass(ModuleConfig config)
throws ServletException {
String tilesProcessorClassname = TilesRequestProcessor.class.getName();
ControllerConfig ctrlConfig = config.getControllerConfig();
String configProcessorClassname = ctrlConfig.getProcessorClass();
// Check if specified classname exist
Class<?> configProcessorClass;
try {
configProcessorClass =
RequestUtils.applicationClass(configProcessorClassname);
} catch (ClassNotFoundException ex) {
log.error(FATAL, "Can't set TilesRequestProcessor: bad class name '{}'.",
configProcessorClassname);
throw new ServletException(ex);
}
// Check to see if request processor uses struts-chain. If so,
// no need to replace the request processor.
if (ComposableRequestProcessor.class.isAssignableFrom(configProcessorClass)) {
return;
}
// Check if it is the default request processor or Tiles one.
// If true, replace by Tiles' one.
if (configProcessorClassname.equals(RequestProcessor.class.getName())
|| configProcessorClassname.endsWith(tilesProcessorClassname)) {
ctrlConfig.setProcessorClass(tilesProcessorClassname);
return;
}
// Check if specified request processor is compatible with Tiles.
Class<?> tilesProcessorClass = TilesRequestProcessor.class; | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/dispatch/ActionDispatcherExample.java | Struts Apps - Examples | 65 |
| org/apache/struts/webapp/dispatch/EventActionDispatcherExample.java | Struts Apps - Examples | 65 |
| org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java | Struts Apps - Examples | 53 |
return dispatcher.execute(mapping, form, request, response);
}
/**
* Example "foo" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doFoo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
fooCount++;
ActionMessages messages = new ActionMessages();
messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/dispatch/ActionDispatcherExample.java | Struts Apps - Examples | 79 |
| org/apache/struts/webapp/dispatch/DispatchExampleAction.java | Struts Apps - Examples | 54 |
| org/apache/struts/webapp/dispatch/EventActionDispatcherExample.java | Struts Apps - Examples | 79 |
| org/apache/struts/webapp/dispatch/EventDispatchActionExample.java | Struts Apps - Examples | 54 |
| org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java | Struts Apps - Examples | 54 |
public ActionForward doFoo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
fooCount++;
ActionMessages messages = new ActionMessages();
messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/validator/DynaValidatorForm.java | Struts Core | 120 |
| org/apache/struts/validator/ValidatorForm.java | Struts Core | 126 |
int validationPage = determinePage(mapping, request);
Validator validator =
Resources.initValidator(validationKey, this, application, request,
errors, validationPage);
try {
validatorResults = validator.validate();
} catch (ValidatorException e) {
log.error(e.getMessage(), e);
}
return errors;
}
// 2014/07/02 - security problem patch.
// Author: NTT DATA Corporation
/**
* Determine validation page.<br>
* If acceptPage of ActionMapping is null, then returns Integer.MAX_VALUE.
* (multi-page validation is disabled. All validation fields are enabled.)<br>
* If page property is less than acceptPage of ActionMapping, returns acceptPage value.<br>
* If page property is greater than or equal to acceptPage of ActionMapping, returns page property value.
*
* @param mapping The mapping used to select this instance.
* @param request The servlet request we are processing.
*
* @return validation page.
*
* @since Struts 1.4.1
*/
protected int determinePage(ActionMapping mapping, HttpServletRequest request) {
Integer acceptPage = mapping.getAcceptPage();
return acceptPage != null ? Math.max(acceptPage.intValue(), getPage()) : Integer.MAX_VALUE;
}
/**
* Returns the Validation key.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
* @return validation key - the form element's name in this case
*/
public String getValidationKey(ActionMapping mapping,
HttpServletRequest request) {
return mapping.getAttribute();
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/dispatch/DispatchExampleAction.java | Struts Apps - Examples | 54 |
| org/apache/struts/webapp/dispatch/EventDispatchActionExample.java | Struts Apps - Examples | 54 |
| org/apache/struts/webapp/dispatch/LookupDispatchExampleAction.java | Struts Apps - Examples | 66 |
| org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java | Struts Apps - Examples | 54 |
public ActionForward doFoo(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
fooCount++;
ActionMessages messages = new ActionMessages();
messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/faces/component/CommandLinkComponent.java | Struts Faces | 361 |
| org/apache/struts/faces/component/FormComponent.java | Struts Faces | 271 |
}
public String getStyle() {
ValueExpression vb = getValueExpression("style");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return style;
}
}
public void setStyle(String style) {
this.style = style;
}
public String getStyleClass() {
ValueExpression vb = getValueExpression("styleClass");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return styleClass;
}
}
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
public String getTabindex() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/faces/component/CommandLinkComponent.java | Struts Faces | 361 |
| org/apache/struts/faces/component/FormComponent.java | Struts Faces | 271 |
| org/apache/struts/faces/component/MessageComponent.java | Struts Faces | 185 |
| org/apache/struts/faces/component/WriteComponent.java | Struts Faces | 119 |
}
public String getStyle() {
ValueExpression vb = getValueExpression("style");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return style;
}
}
public void setStyle(String style) {
this.style = style;
}
public String getStyleClass() {
ValueExpression vb = getValueExpression("styleClass");
if (vb != null) {
return (String) vb.getValue(getFacesContext().getELContext());
} else {
return styleClass;
}
}
public void setStyleClass(String styleClass) {
this.styleClass = styleClass;
}
public String getTabindex() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/ErrorsTag.java | Struts Taglib | 115 |
| org/apache/struts/taglib/html/MessagesTag.java | Struts Taglib | 128 |
public String getBundle() {
return (this.bundle);
}
public void setBundle(String bundle) {
this.bundle = bundle;
}
public String getLocale() {
return (this.locale);
}
public void setLocale(String locale) {
this.locale = locale;
}
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
public String getProperty() {
return (this.property);
}
public void setProperty(String property) {
this.property = property;
}
public String getHeader() {
return (header == null) ? "errors.header" : header; | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/config/ConfigHelper.java | Struts Core | 370 |
| org/apache/struts/taglib/TagUtils.java | Struts Taglib | 674 |
String servletMapping = getServletMapping();
if (servletMapping != null) {
String queryString = null;
int question = action.indexOf("?");
if (question >= 0) {
queryString = action.substring(question);
}
String actionMapping = getActionMappingName(action);
if (servletMapping.startsWith("*.")) {
value.append(actionMapping);
value.append(servletMapping.substring(1));
} else if (servletMapping.endsWith("/*")) {
value.append(servletMapping.substring(0,
servletMapping.length() - 2));
value.append(actionMapping);
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/bean/DefineTag.java | Struts Taglib | 100 |
| org/apache/struts/taglib/bean/SizeTag.java | Struts Taglib | 87 |
public String getId() {
return (this.id);
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return (this.name);
}
public void setName(String name) {
this.name = name;
}
public String getProperty() {
return (this.property);
}
public void setProperty(String property) {
this.property = property;
}
public String getScope() {
return (this.scope);
}
public void setScope(String scope) {
this.scope = scope;
}
public String getToScope() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/el/exercise/TestBean.java | Struts Apps - EL Examples | 329 |
| org/apache/struts/webapp/exercise/TestBean.java | Struts Apps - Examples | 322 |
}
private String stringMultibox[] = new String[0];
public String[] getStringMultibox() {
return (this.stringMultibox);
}
public void setStringMultibox(String stringMultibox[]) {
this.stringMultibox = stringMultibox;
}
/**
* A String property.
*/
private String stringProperty = "This is a string";
public String getStringProperty() {
return (this.stringProperty);
}
public void setStringProperty(String stringProperty) {
this.stringProperty = stringProperty;
}
/**
* An empty String property.
*/
private String emptyStringProperty = "";
public String getEmptyStringProperty() {
return (this.emptyStringProperty);
}
public void setEmptyStringProperty(String emptyStringProperty) {
this.emptyStringProperty = emptyStringProperty;
}
/**
* A list of coordinate objects.
*/
private Coord[] coords = | ||
| File | Project | Line |
|---|---|---|
| examples/logic/PrepareLogicAction.java | Struts Apps - Cookbook | 88 |
| examples/options/PrepareOptionsAction.java | Struts Apps - Cookbook | 125 |
request.setAttribute("stringValue", "Hello, world!");
/* Collection of custom beans */
ArrayList<BookBean> books = new ArrayList<>();
books.add(new BookBean("0596003285", "Programming Jakarta Struts"));
books.add(new BookBean("1930110502", "Struts in Action"));
books.add(new BookBean("1861007817", "Professional Struts Applications"));
books.add(new BookBean("0672324725", "Struts Kick Start"));
books.add(new BookBean("0471213020", "Mastering Jakarta Struts"));
books.add(new BookBean("1558608621", "The Struts Framework"));
books.add(new BookBean("0971661901", "Struts Fast Track"));
request.setAttribute("books", books); | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/html/BaseHandlerTag.java | Struts Taglib | 820 |
| org/apache/struts/taglib/html/OptionTag.java | Struts Taglib | 439 |
titleKey = null;
}
// ------------------------------------------------------ Protected Methods
/**
* Return the text specified by the literal value or the message resources
* key, if any; otherwise return <code>null</code>.
*
* @param literal Literal text value or <code>null</code>
* @param key Message resources key or <code>null</code>
* @throws JspException if both arguments are non-null
*/
protected String message(String literal, String key)
throws JspException {
if (literal != null) {
if (key != null) {
JspException e =
new JspException(messages.getMessage("common.both"));
TagUtils.getInstance().saveException(pageContext, e);
throw e;
} else {
return (literal);
}
} else {
if (key != null) {
return TagUtils.getInstance().message(pageContext, getBundle(),
getLocale(), key);
} else {
return null;
}
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/webapp/example/RegistrationBacking.java | Struts Apps - Faces Example 1 | 115 |
| org/apache/struts/webapp/example2/RegistrationBacking.java | Struts Apps - Faces Example 2 | 83 |
StringBuilder url = subscription(context);
url.append("?action=Delete");
url.append("&username=");
User user = (User)
context.getExternalContext().getSessionMap().get("user");
url.append(user.getUsername());
url.append("&host=");
Subscription subscription = (Subscription)
context.getExternalContext().getRequestMap().get("subscription");
url.append(subscription.getHost());
forward(context, url.toString());
return (null);
}
/**
* <p>Edit an existing subscription.</p>
*/
public String edit() { | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/tiles/taglib/PutTag.java | Struts Tiles | 394 |
| org/apache/struts/tiles/taglib/util/TagUtils.java | Struts Tiles | 212 |
} catch (NoSuchMethodException ex) {
throw new JspException(
"Error - component.PutAttributeTag : Error while retrieving value from bean '"
+ beanName
+ "' with property '"
+ beanProperty
+ "' in scope '"
+ beanScope
+ "'. (exception : "
+ ex.getMessage(), ex);
} catch (InvocationTargetException ex) {
throw new JspException(
"Error - component.PutAttributeTag : Error while retrieving value from bean '"
+ beanName
+ "' with property '"
+ beanProperty
+ "' in scope '"
+ beanScope
+ "'. (exception : "
+ ex.getMessage(), ex);
} catch (IllegalAccessException ex) {
throw new JspException(
"Error - component.PutAttributeTag : Error while retrieving value from bean '"
+ beanName
+ "' with property '"
+ beanProperty
+ "' in scope '"
+ beanScope
+ "'. (exception : "
+ ex.getMessage(), ex);
}
}
/**
* Do start tag.
*/
public int doStartTag() throws JspException { | ||
| File | Project | Line |
|---|---|---|
| org/apache/strutsel/taglib/logic/ELMatchTag.java | Struts EL | 44 |
| org/apache/strutsel/taglib/logic/ELNotMatchTag.java | Struts EL | 44 |
private String expr;
/**
* Returns the evaluated expression.
*/
public String getExpr() {
return expr;
}
/**
* Sets the evaluated expression.
*/
public void setExpr(String expr) {
this.expr = expr;
}
/**
* Releases state of custom tag so this instance can be reused.
*/
public void release() {
super.release();
setExpr(null);
}
/**
* Evaluates the condition that is being tested by this particular tag,
* and returns {@code true} if the nested body content of this tag
* should be evaluated, or {@code false} if it should be skipped.
*
* @param desired Desired value for a true result
* @throws JspException if a JSP exception occurs
*/
protected boolean condition(boolean desired)
throws JspException {
boolean result = false;
if (getExpr() != null) {
result =
ELMatchSupport.condition(desired, getExpr(), value,
location, messages, pageContext);
} else {
result = super.condition(desired);
}
return result;
}
} | ||
| File | Project | Line |
|---|---|---|
| org/apache/struts/taglib/nested/bean/NestedDefineTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/bean/NestedMessageTag.java | Struts Taglib | 40 |
| org/apache/struts/taglib/nested/bean/NestedSizeTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/bean/NestedWriteTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedCheckboxTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedErrorsTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedFileTag.java | Struts Taglib | 40 |
| org/apache/struts/taglib/nested/html/NestedHiddenTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedImgTag.java | Struts Taglib | 40 |
| org/apache/struts/taglib/nested/html/NestedMessagesTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/html/NestedMultiboxTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedOptionsCollectionTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedPasswordTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedRadioTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedSelectTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedTextTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/html/NestedTextareaTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedEmptyTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedEqualTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedGreaterEqualTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedGreaterThanTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedLessEqualTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedLessThanTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedMatchTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedMessagesNotPresentTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedMessagesPresentTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedNotEmptyTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedNotEqualTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedNotMatchTag.java | Struts Taglib | 41 |
| org/apache/struts/taglib/nested/logic/NestedNotPresentTag.java | Struts Taglib | 42 |
| org/apache/struts/taglib/nested/logic/NestedPresentTag.java | Struts Taglib | 41 |
private String originalName = null;
private String originalProperty = null;
/**
* Overriding method of the heart of the matter. Gets the relative
* property and leaves the rest up to the original tag implementation.
* Sweet.
*
* @return int JSP continuation directive. This is in the hands of the
* super class.
*/
public int doStartTag() throws JspException {
// get the original properties
originalName = getName();
originalProperty = getProperty();
// request
HttpServletRequest request =
(HttpServletRequest) pageContext.getRequest();
// set the properties
NestedPropertyHelper.setNestedProperties(request, this);
// let the super do it's thing
return super.doStartTag();
}
/**
* Complete the processing of the tag. The nested tags here will restore
* all the original value for the tag itself and the nesting context.
*
* @return int to describe the next step for the JSP processor
* @throws JspException for the bad things JSP's do
*/
public int doEndTag() throws JspException {
// do the super's ending part
int i = super.doEndTag();
// reset the properties
setName(originalName);
setProperty(originalProperty);
// continue
return i;
}
/**
* Release the tag's resources and reset the values.
*/
public void release() {
super.release();
// reset the originals
originalName = null;
originalProperty = null;
}
} | ||


