I am new to Struts but I had a similar problem and pointed the input to the
action that prepares data for the page:
<action path="/itemInfo"
scope="request"
name="editInfoForm"
parameter="NEW"
validate="false"
type="com.nlg.fc.action.ViewInfoListAction"/>
<action path="/updateItem"
scope="request"
name="editInfoForm"
input="/itemInfo.do"
validate="true"
type="com.nlg.fc.action.UpdateInfoAction"/>
[EMAIL PROTECTED] on 04/16/2002 04:30:05 PM
Please respond to "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: How to populate page beans before Validation forwards to the "inp ut"
page?
Hello,
I have a form which requires some beans to be present in the request, in
order to populate several dropdown boxes on the form. This occurs in an
"edit" action which then returns an ActionForward to the form JSP. That
much works fine.
However, when the user tries to save their changes by calling the "save"
action, automatic validation kicks in and the ActionServlet automagically
forwards directly to the JSP listed in the "input" attribute of the "save"
action. Because it goes directly to the JSP, no Action class gets a chance
to populate these request beans, so the page pukes when it tries to render
the dropdown boxes.
Now, here's the rub. Changing the "input" attribute of the "save" action to
point to the "edit" action ITSELF, instead of to the corresponding JSP page,
DOES NOTHING. The ActionServlet still forwards control to the JSP directly,
skipping the "edit" action. It never gets called! Is that weird or what?
Now, I realize there's a simple fix to my original problem, which is that
the dropdown boxes don't populate without the beans that drive them being in
the request. I could put those beans in the application scope, for instance
(ServletContext), and to tell you the truth, they should probably be there
anyway.
Nevertheless, this doesn't solve the general problem, which appears to be
that the "input" attribute of an Action Mapping can't point to another
Action. This seems so nonsensical, though, that I can hardly believe it.
Can someone enlighten me on what's going on here? Thanks!
Cheers,
David
David A. Ventimiglia
Wells Fargo Private Client Services
(415) 396-0414 (work)
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>