Here is the problem; (sorry for long text)

Normally, when you validate an actionform and there is a validation
error, the "input" argument
in struts-config.xml points you back to the inputform, so you can place
an error message
on the form where the incorrect input is..

First problem:
----------------------
If the input form uses some parameter from request, it cannot find this
parameter
when you try to go back to the form after an unsuccesful validation..
For example; a form where you add a user, and there is a parameter
"languages"
from which the user can select a language on the form..

(in the example the "/actions/adduserform" collects the languages and
puts them
as a parameter in request, so the add user form displays those languages
from that parameter)

If after unsuccesful validation, you just point back to
/forms/adduserform.jsp,
you will get an error because the jsp page cannot find the attribute
languages anymore.
I solved this problem by recollecting the languages on unsuccesfull
validation..

(so struts-config.xml looks like:)

<action path="/actions/adduserform"
                 type="user.actions.AddUserFormAction">
            <forward name="success"  path="/forms/adduserform.jsp" />
</action>
     
<action path="/actions/adduser"
     type="user.actions.AddUserAction"
     name="addUserFormBean"
     scope="request"
     validate="true"
     input="/actions/adduserform.do">
            <forward name="succes" path="/succes.do" />
</action>

So far, so good.. but:

Real problem:
-----------------
If (for instance on a user edit), you first choose which user to edit
and then
go to an edit form, how can you on unsuccesful validation of the edit form
return to that editform? The choice of which user you choose is lost......

So.. you collect all the users:

<action path="/actions/edituserselectionform"
      type="user.actions.CollectusersAction">
    <forward name="success" path="/forms/edituserselectionform.jsp" />
</action>
       
You choose which one you wanna edit:

<action path="/actions/edituserform"
      type="user.actions.EdituserFormAction"
      name="selectedUserFormBean">
<forward name="success"  path="/forms/edituserform.jsp" />
</action>
       
And you display the edit user form here..

<action path="/actions/edituser"
      type="user.actions.EdituserAction"
      name="edituserFormBean"
      scope="request"
      validate="true"
      input="??????????????????">
     <forward name="success"  path="/actions/usersoverview.do" />
</action>

If i put as input "/actions/edituserform.do", it cannot remember which
user i selected.
Any suggestions?

Thanks for your time!

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

Reply via email to