Hi all. 

 

Struts newb reporting. I have been working on a new web app for our company
to streamline registration, and am still stumbling through the basic
building blocks of struts. I am using Struts 1.3.5 on Tomcat v5.5. I am
trying to add error handling into my process now.

 

The current problem is, I cannot use the ActionErrors functionality to
display errors on the jsp page.

 

Here's what I have:

 

Struts-config.xml:

            <global-forwards>

                        <forward name="error" path="/error.jsp"/>

            </global-forwards>

 

            <action-mappings>       

                        <action path="/Register2"

 
type="mil.navy.spawar.registration.action.RegisterAction">

                                    <forward name="register2"
path="/register2.jsp" />

                                    <forward name="existingUser"
path="/existingUser.jsp" />

                        </action>          

            </action-mappings>                  

            

            

RegisterAction.java:

public class RegisterAction extends Action {

            

            public ActionForward execute(

                                    ActionMapping mapping,

                                    ActionForm form,

                                    HttpServletRequest request,

                                    HttpServletResponse response) throws
Exception {

                                    

                        ....

                        if(request.getParameter("portal") == null) {

                                    MessageResources messageResources =
getResources(request);

                                    ActionErrors errors = new
ActionErrors();

                                    errors.add("portalNotFound", new
ActionMessage(messageResources.getMessage("errors.portal.not.supplied")));

                                    saveErrors(request, errors);

                                    return mapping.findForward("error");

                        }

                        .....

                        return mapping.findForward("register2");

                        

error.jsp:

<body>

<logic:messagesPresent>

            <html:errors/>

</logic:messagesPresent>

</body>

 

I've even tried

<body>

            <html:errors/>

</body>

 

and in my messageResources properties:

 

errors.portal.not.supplied=You must access the registration page supplying a
portal parameter.

 

 

I get redirected to the errors page correctly if I neglect to put the portal
parameter on the action call, but the ActionError does not display on the
screen. Does anyone have any idea why this is failing to display the errors?

 

Thanks much,

 

 

Perry Minchew

Systems Integrator

SPAWAR Systems Charleston

Office : (843) 218.7031

Cell : (843) 822.1555

 

Reply via email to