struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: FormBeans
Date Thu, 01 Feb 2001 21:53:30 GMT
John Hunt wrote:

> 1.What is the normal practice in the case where you
> have two pages, and part of the input entered in the
> first page needs to be displayed in the second page. I
> would say use the same form bean for both the pages.
> Any objections to this?
>

This would also be the normal approach to a multi-page form -- all of
the pages would share the same form bean, whose properties would be all
the fields that appear on *any* of the pages.

The interesting part of this is knowing what to check in your validate()
method, which will be called as each page is submitted.

>
> 2. When displaying readonly contents  on a page where
> the contents were obtained by some processing done by
> the Acton class which forwarded to this page, is it
> advisable to put the output page's bean in session
> scope and have the action class populate it ( or even
> under request scope ). Or is it better to expose many
> beans from the Action class that produced the data and
> let the form bean get populated in the  jsp page ( for
> the readonly attributes )? So these attributes
> actually need not be propagated to the next action
> class. Suggestions???
>

I would not generally use the form bean for read only attributes --
instead, I'd just create request or session attributes (depending on how
long you wish to keep them) and use <bean:write> to display the
read-only contents of those beans.  This works even when you are not
inside a form, and you can have any number of beans accessible to
<bean:write>, but only one form bean per form.

Craig



Mime
View raw message