I can't think of anything you can do in Struts currently to get this to work
in the "reset" method - all the relevant code is  in the
RequestUtils.populate() method and we would have to refactor the multipart
processing to resolve this (maybe you should open an enhacement request in
bugzilla for it).

Having said that, your code looks like it is doing whats needed to populate
your checkbox values - can't you just move this code into the Action's
execute method?

Niall

----- Original Message ----- 
From: "Diego" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 20, 2004 8:26 AM
Subject: Re: Multipart forms


> Thanks for your answer Niall. If I can't get the parameters in the reset()
> method, then I don't know how to solve my problem. My ActionForm is on
session
> and it's a wizard-like one. The jsp has tabs to go to any page at any
time.
> What I do with non-multipart forms is something like this in the reset()
> method:
>
> String page = request.getParameter("page");
> if (page != null && page.equals("1")) {
>     String mycheckbox = request.getParameter("mycheckbox");
>     //if mycheckbox==null,the user hasn't checked it->set the property to
N
>     mycheckbox == null ? setMycheckbox("N") : setMycheckbox("Y");
> } else if (page != null && page.equals("2")) {
>     ...
> }
>
> This works fine (I'm actually using multibox fields). I'm not using server
> validation in validate() method for several reasons, so I can't use it.
Any
> idea how can I do this with a multipart form?
>
> Thanks again.
>
> >You can't get them in the reset() method. Parameters in multipart
requests
> >are processed later and made available by wrapping the original request
in
> >MultipartRequestWrapper and  storing the "normal" request parameters in
that
> >wrapper. Thats not done until the form is populated. The first chance you
> >get to do anything is in the form's validate method.
>
> >Niall
>
> >----- Original Message -----
> >From: "Diego" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Monday, July 19, 2004 3:26 PM
> >Subject: Fwd: Multipart forms
>
>
> >> Hi! I have a problem when I want to get some parameters in the reset()
> method
> >> of
> >> an ActionForm.
> >>
> >> If the form is a "normal" form, then I simply call
> >> request.getParameter("myparameter") and the parameter is retrieved with
no
> >> problem.
> >>
> >> But if the form is of type multipart, then I always get null. The
> parameter
> >> table seems to be filled later, on the RequestProcessor. I need to get
> >> parameters in the reset() method, specifically the "page" parameter, to
> deal
> >> with checkboxes in my wizard-style multipage form.
> >>
> >> How can I do it in the simplest way possible?
> >>
> >> Thanks in advance.
> >>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



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

Reply via email to