struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: Alternatives To Accessing Static Methods
Date Tue, 16 Dec 2014 15:30:58 GMT
> 
> I was wanting to get some feedback on how to best move away from the
> static method calls in OGNL.  We have used them quite a bit, 
> specifically to populate Map of options for the select tag.  There 
> are multiple pages that the select is used on so I don't want to 
> hard code the options in each select.
> 
> I realize that I can make it a property in the action and have the 
> action call over to the class supplying the map.  However, is there 
> a better way that I may be missing to make it available to the 
> action if needed?  I don't want to have to add a property to every 
> action and then also have to put checks in to make sure it 
> repopulates when the validation fails.
> 
> Thanks for your suggestions!
> 
> 

I often do this by implementing it in a static method and giving the 
action a getter that calls that static method. So you need some 
boilerplate but at least you don't need an additional member in the 
action.


regards,
Christoph

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message