Re: Using Util class inside JSP

2013-07-24 Thread Antonio Sánchez
Thank you both. In the future, whenever possible, I'll try to put this logic in a base class. Kind regards. El Martes, 23 de julio de 2013 12:59:06 Dave Newton escribió: > I don't know if it's *explicitly* a bad practice, but it's pretty easy to > hose things up with arbitrary static method acc

Re: Using Util class inside JSP

2013-07-23 Thread Dave Newton
I don't know if it's *explicitly* a bad practice, but it's pretty easy to hose things up with arbitrary static method access. Personally, I wouldn't, and would instead defer things like that to a custom tag or, as you said, a method in the base class, properly named, allowing simple getter access

Re: Using Util class inside JSP

2013-07-23 Thread Paul Benedict
If you want to check if the user is in session, I would create for yourself a BaseAction class which all your Actions extend. In Base Action, expose a getter to do that calculation. It's sounds like you really have a case where you want this property on the Value Stack on each invocation. I use th

Re: Using Util class inside JSP

2013-07-23 Thread Antonio Sánchez
Thank you. Is it discouraged or is it considered a bad practice to use static code in OGNL? It is disallowed by default. Actually, the code would be something like: Do you think it is a better practice to use a base class whenever possible? looks simpler. El Martes, 23 de julio de 2013

Re: Using Util class inside JSP

2013-07-23 Thread Dave Newton
Enable static method access: Then use OGNL's static method notation [1]: Dave [1] http://struts.apache.org/release/2.3.x/docs/ognl-basics.html#OGNLBasics-Accessingstaticproperties On Tue, Jul 23, 2013 at 7:27 AM, Antonio Sánchez wrote: > Hi. > > How can I use utilities classes i

Using Util class inside JSP

2013-07-23 Thread Antonio Sánchez
Hi. How can I use utilities classes inside JSPs? For instance, currently I'm using: for asking if user is in session, but I wan to use a Java method instead. One option is defining a basic Action class and make all action extend it, but in some cases I rather prefer something like: Util.i