WelcomeAction.javaAPI DocExample2981Mon Aug 09 16:26:28 BST 2004org.apache.struts.webapp.example


public final class WelcomeAction extends BaseAction

Confirm required resources are available. If a resource is missing, forward to "failure". Otherwise, forward to "success", where success is usually the "welcome" page.

Since "required resources" includes the application MessageResources the failure page must not use the standard error or message tags. Instead, it display the Strings stored in an ArrayList stored under the request attribute "ERROR".

$Revision: 1.1 $ $Date: 2004/03/09 04:36:49 $

Fields Summary
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        // Setup message array in case there are errors
        ArrayList messages = new ArrayList();

        // Confirm message resources loaded
        MessageResources resources = getResources(request);
        if (resources==null) {

        // Confirm database loaded
        //UserDatabase userDatabase = getUserDatabase(request);
        UserDatabase userDatabase = getUserDatabase();
        if (userDatabase==null) {

        // If there were errors, forward to our failure page
        if (messages.size()>0) {
            return findFailure(mapping);

        // Forward to our success page
        return findSuccess(mapping);