struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <>
Subject Re: Am I about to create an anti-pattern?
Date Wed, 21 Apr 2004 07:15:26 GMT
generally speaking you should seperate out the search functionality from 
the object lists. You could have two different forms quite easily and 
when you decide to enhance your search functionality it could quickly 
get really messy.

On 04/21/2004 06:44 AM Rick Reumann wrote:
> Joe Hertz wrote:
>> Now I've also got some screens that need input criteria for the search
>> that results in the data upon the screen. I'm contemplating adding a Map
>> to this form for this purpose.
>> My intentions are good. Any thoughts about where this road I am paving
>> is going to?
> I try to keep my form beans only responsible for collecting user 
> inputted data (the exception is I often keep the parameter used for my 
> dispatch actions in the form bean as well). I tend to not like to bloat 
> an ActionForm with things like Lists or Maps that are used solely for 
> the purpose of display data used for collecting input. I 'think' what 
> you are saying in the above is that you'd have a Map in your form bean 
> that would be used to provide a drop down list (or something similar). I 
> usually opt for putting stuff like this in the session or, depending on 
> whether form validation is needed or not, you could simply make the call 
> to the business layer to return this Map each time and populate in 
> request scope. If you need the Map around for the life time of the 
> user's session set in there or put it in request scope each time.
> The 'road you are paving' isn't really all that bad in my opinion, but 
> to me Action Forms shouldn't hold this kind of info. After all at some 
> point you are having to call a business class in your action in order to 
> populate the Action Form Map or List (a definite no-no is having the 
> form bean actually make model layer calls to populate the Map or List). 
> Since after getting the List or Map from the model it's just as easy to 
> put in Session or Request scope as it is to put it in the form bean. 
> Plus, for you plan to work it would appear the form bean would always 
> have to have session scope, otherwise you'd still be making a model 
> layer call to get the List or Map and then populate the form bean each 
> time. Sometimes my form beans make sense to be in Session scope but most 
> of the time request scope will work fine.

struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message