Hello,

 

I have an Action Mapping that looks like this:

 

    <action path="/saveAuthorityLevel"

            type="com.wellsfargo.pcsweb.controller.SaveAuthorityLevelAction"

            name="authorityLevelForm"

            input="/editAuthorityLevel.do"

            scope="request">

      <forward name="success" path="/listAuthorityLevels.do"/>

    </action>

 

The idea is that, when Struts receives the "saveAuthorityLevel" command,
it'll run authorityLevelForm.validate(), and if validation fails, will
redirect to the "editAuthorityLevel" Action.  The reason I want to redirect
there instead of to a JSP is because I've been using my Actions to supply
any beans that the pages need.  In my case, I've a couple beans (actually,
collections) that supply the list of values for some dropdown boxes on the
JSP associated with the "editAuthorityLevel" action.  And, in fact, these
beans are populated in the EditAuthorityLevelAction class which is part of
this mapping:

 

    <action path="/editAuthorityLevel"

            type="com.wellsfargo.pcsweb.controller.EditAuthorityLevelAction"

            name="authorityLevelForm"

            input="/editAuthorityLevel.jsp"

            scope="request">

      <forward name="success" path="/editAuthorityLevel.jsp"/>

    </action>

 

The trouble is, Struts seems to skip the Action class when validation fails,
and goes straight to the JSP in the "editAuthorityLevel" mapping.  So, a
bunch of beans aren't populated.  I know this because I get an error about
the missing beans, and also because when I attach a debugger to the server
process, it skips right past my Action.

 

Basically, I'm trying to get a handle on how form validation should be set
up.  Should my "input" attribute be set to the actual JSP of the input form,
or should it be set to the Action Mapping that LEADS TO the JSP of the input
form.  If it's the JSP, then how will any request-scoped beans the page
needs get populated?

 

Also, is this an usual setup, having different Action classes, and different
Action mappings, for "Edit" and "Save"?  My idea is that "Edit" is really
more like "View"; it's role is to lookup a particular bean.  The role of
"Save" is to persist changes to that bean back to the db.  It seems like
other people combine these into one Action and one Mapping, and use an input
parameter to distinguish.  Which way is better?

 

Thanks!

Cheers,

David

 

David A. Ventimiglia

Wells Fargo Private Client Services

(415) 396-0414 (work)

 

Reply via email to