Konrad Billewicz wrote:
Hello,
I have a complicated form with mulit-level menu (several <select>'s with
onchange='submit()' ). I'm not sure how I should organize my Actions.
Currently I have PrepareEditXYZAction which handles the JSP page. Form in
the JSP page routes back to PrepareEditXYZAction. Inside
PrepareEditXYZAction action I'm making a decision (based on check if submit
button was clicked) what to show - JSP page (if submit wasn't clicked) or
EditXYZAction (if it was). EditXYZAction is validating data and invokes
managers to do the job.
I'm using Struts validation based on ValidationForm's. PrepareEditXYZAction
has validate set to false while EditXYZAction has it set to true and input
set to PrepareEditXYZAction (/prepareEditXYZAction.do).
It sounds nice but I have a problem when validation error occurs. In this
case I have an infinite loop bacause:
1. PrepareEditXYZAction redirects to EditXYZAction (bacause submit was
clicked)
2. Validation before EditXYZAction fails and redirects to
PrepareEditXYZAction.
3. Go to 1.
I have several ideas how to handle this problem but I'm not sure if I'm
doing it right. Do you know pattern for handling such cases? I look thought
Struts manual, Struts in Action and the Web but found nothing interesting.
Sounds like you have some broken flow control there... I would expect
that PrepareEditXYZAction would forward to a JSP, and that the JSP would
have a form that submits to EditXYZAction. EditXYZAction would have
'intput' set to point to PrepareEditXYZAction which would mean that on
validation errors, PrepareEditXYZAction would be called and would
forward to the JSP again. In other words, (1) sounds wrong.
Can you post your action mapping definitions from struts-config, and the
relevant bits of your JSP code (specifically the html:form tag)?
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]