> 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.

I understand that the only thing you consider is not right is that decision 
edit-or-update is made in PrepareEditXYZAction, not in EditXYZAction. I have 
made this choice knowingly for several reasons:
1. Prepare action should be responsible for preparing parameters, 
compleately. I could image that there is another action which uses 
complately different mechanism for getting parameters (for example getting 
pure IDs from some source) but executes the same Edit action. I'm not sure 
is it right idea but it sounds good in my opinion.
2. I had problems with validation. My form is multi-level and I want 
validation only when parameters are complete. In mappings of Edit action I 
have validation set to true, so any partial data form is rejected 
automatically. I don't tend to resign from automatic validation bacause need 
of such a resign seems to be, in my opinion, a design mistake.

Currently I had solve my problem differently and I'm quite satisfied with 
it. I have made third action, very ganeric, named RelayAction. More about it 
can be found at [1]. What do you think about this solution?

[1] http://www.jguru.com/faq/view.jsp?EID=995474

> Can you post your action mapping definitions from struts-config, and the 
> relevant bits of your JSP code (specifically the html:form tag)?

Mappings:

<!-- this action prepares parameters for the edit -->
<action path="/prepareEditNewEmailForNewCase"
type="pl.infovide.portlet.admin.email.action.PrepareEditNewEmailForNewCaseAction"
name="newEmailForm"
validate="false"
scope="session"
>
<forward name="update" path="/email/editNewEmailForNewCase.jsp" />
<forward name="edit" path="/editNewEmailForNewCase.do" />
</action>

<!-- this action edits -->
<action path="/editNewEmailForNewCase"
type="pl.infovide.portlet.admin.email.action.EditNewEmailForNewCaseAction"
name="newEmailForm"
validate="true"
input="/prepareEditNewEmailForNewCase.do"
scope="session"
>
<forward name="success" path="/listNewEmails.do" />
<forward name="update" path="/prepareEditNewEmailForNewCase.do" />
</action>


and the JSP:

<html:form action="/submitEditNewEmailForNewCase.do">

...

<html:submit property="update">
<bean:message key="email.update" />
</html:submit>

<html:submit property="edit">
<bean:message key="email.submit" />
</html:submit>

</html:form>

Best regards,
Konrad Billewicz




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to