Thanks Guys.

Being new to Struts is the only issue I have right now and this is the
reason I am not able to use my own ideas to the fuller. Your suggestions
have helped a lot.

Baran 


newton.dave wrote:
> 
> mitch gorman wrote:
>> Baran wrote:
>>> This is about implementing reusability in the actions. I am struggling
>>> to
>>> identify the ways how we can share some comming functionality between
>>> different actions. Lets say I got a list of users i need to use as a
>>> combobox list at multiple pages. Right now I have to push the code in
>>> every
>>> action I need that list displayed for. 
>>>
>>> any idea if I can use that list at multiple places without repeating the
>>> code. I guess we need to have it static, but not sure how we can use a
>>> list
>>> as an static element
>>
>>        it's a matter of reorganizing your Java classes.  extract all the
>> code that's common to all your user-related classes into a class called
>> UserActionSupport, and then have all those user-related classes extend
>> from UserActionSupport.
> 
> For another option, consider moving that kind of code into service 
> objects. I'm not convinced the implementation of that behavior belongs 
> in the action class unless it's *very* tightly-focused and never used 
> anywhere else.
> 
> There are various mechanisms that allow us to pull common code into our 
> actions without inheritance (think DI/IoC). Using them keeps our action 
> class hierarchy thin and light.
> 
> Putting the code into our actions proper *could* lead to a heavier 
> action hierarchy than necessary, where we'd use only a small portion of 
> the functionality at any given time.
> 
> A combination of the two, where we split the app into areas of 
> functionality, create base classes for each that pull in required 
> services, and add additional services in sub-classes only when we need 
> to, may be the most flexible.
> 
> Dave
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Struts-access-static-list-tp23018571p23032982.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to