struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Papper <mp...@geocities.com>
Subject Re: Multi-page form
Date Wed, 11 Oct 2000 06:52:55 GMT
This email is regarding use of checkboxes in forms AND an issue with
setXXX methods in forms.

1) I suspect that an unchecked box is not handled correctly and
2) if I have a POST variable but no corresponding SetXXX method in the
Form class I get an exception.

Lets see, the logic flow seems to be (I use POST, but it could be GET as
well):

1) the XXForm class reads the POST variables and reads all the "set"
methods in its class.
2) It then sets all member variables within the Form from the POST
parameters

In my experience there are two problems:
1) it does not read non-existant checkboxes in the POST – so it cannot
set the corresponding Form member variable – how can we do this?
Shouldn't struts do this automagically for us (if struts set all SetXXX
methods that took a boolean parameter automatically to false, it would
not work with multiple forms, so the checkbox tag should also generate a
hidden variable that says that "no" checkbox was returned)

2) if there is a POST variable but no corresponding Form SetXXX method it
throws an exception. It would be nicer if struts emited a warning or
ignored the situation.

Has anyone else encountered these 2 problems?

When is it "safe" to trash my "alpha" structs version (mid August) and
get a 1.0 release? Does it exist yet? After apacheCon?

Mike Papper
mpapp@geocities.com

--------------------------------

>>>>>>>>>>>>>>>>>> Original Message
<<<<<<<<<<<<<<<<<<

On 10/10/2000, 1:42:22 PM, Sean Moore <seanmoore@mindspring.com> wrote
regarding Re: Multi-page form:


> > Jason Kitchen wrote:
> > I still think you're missing the point - maybe I didn't explain myself
clearly.
> > The solution you provide above means that each time you move a field from
> > "step 1 form" to "step 2 form" or vice-versa you need to modify the
correct
> > "partialValidate" method. What I would like to do is to be able to move
fields
> > to another form with no code impact (other than JSP). I think that this
is what
> > the struts designers intended (comments from the struts developers ?) but
> > the validations are preventing the relaization of this goal.
> >

> Thanks Jason - that is exactly what I am trying to do.
> Maybe I am missing it but I have not heard a solution that does not
> involve a framework change??

> But Jason mentions this proposed modification

> > In addition I think that this is easily achievable with a few
modifications to the
> > struts framework:
> >
> > - Change the ValidatingActionForm interface - the signature to the
validate() method
> >   becomes: public String[] validate(HttpServletRequest request);
> >
> > - In ActionServlet.processValidate() we need to pass the
HttpServletRequest object
> >   as a parameter when we call the validate method.


> I guess after having the HttpServletRequest you can go thru all of the
> arguments that were submitted and then select the ones to validate.
> This is kind of what struts is already doing for you
> by setting all of the variables in the bean.
> I guess I was hoping for something a little more cleaner.  I
> Just not sure what?

> Am I misunderstanding the solution the modification will allow

> Thanks,
> Sean

Mime
View raw message