But than doesn't it defeat the purpose of the validate() method in the form
and complicates the code?

Wouldn't it be better to have some sort of <htlm:label ...> or something to
allow to show some form fields not as input field but as simple text.

This problem must have been discussed already. If you have any reference
discussions I will be happy to have a look.

Emmanuel

----- Original Message -----
From: "Troy Hart" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 03, 2001 8:23 PM
Subject: Re: Validation errors and scope.


> Beans that were in the request when the page was rendered are long gone
when
> you submit a "new" request from that page. Therefore, you must re-create
them
> and put them back in the request if the validation fails. Many people
forego
> validation in the form and do it in the action instead to accommodate this
> need...
>
> Troy
>
> On Monday 03 September 2001 12:10 pm, you wrote:
> > Hi,
> >
> > My question concerns beans in the request scope and what happens to them
> > when validation fails. In fact I know they disappear, and that is my
> > problem. I do not want to use the session scope to store them for the
> > reasons below.
> >
> > THE CONTEXT
> >
> > I am on an intranet project where it has been decided to have very long
> > session time out. We will have quiet a few users on the system (~ 500),
so
> > we want to put our beans (whether forms or other beans) in the request
> > scope as we don't want to have too many of them in the session (too much
> > memory would be used too long).
> >
> > My pages contain some dynamic content, which I pass on to my jsp through
> > beans (stored in the request). The problem is that when the forms are
> > validated and fail validation, only the data that is in the form is kept
as
> > the user is redirected to the data-entry page. Any object in the request
is
> > purged.
> >
> > POTENTIAL SOLUTIONS but not quiet satisfying
> >
> > The <html:hidden ...> tag:
> > The beans I use for the dynamic content are too complex to be handled
> > through the <html:hidden ...> tag, so that is not an option. And anyway,
> > the form is not a good to put these beans in as they are not data to be
> > modified by the user.
> >
> > Using the session scope:
> > One of the solutions is to use the session scope and remove the beans
from
> > the session once we don't need them anymore. But this can be easily
> > forgotten and is not obvious to spot. It also reminds me too much of
C++.
> > :(
> >
> > SO...
> >
> > So... Is there any way in struts that would allow the data in the
request
> > scope to be reused when validation fails? Or another to organise the
lot?
> > Did I miss something?
>
> ----------------------------------------
> Content-Type: text/html; charset="iso-8859-1"; name="Attachment: 1"
> Content-Transfer-Encoding: quoted-printable
> Content-Description:
> ----------------------------------------


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to