Enable static method access:

    <constant name="struts.ognl.allowStaticMethodAccess" value="true"/>

Then use OGNL's static method notation [1]:

    <s:if test="%{@Util@isUserInSession()}">


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
<juntandolin...@gmail.com>wrote:

> Hi.
>
> How can I use utilities classes inside JSPs?
>
> For instance, currently I'm using:
>
> <s:if test="#session.USER == null">
>
> 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.instance().isUserInSession() or
>
> Util.isUserInSession(),
>
> and
>
> <s:if test="isUserInSession()">
>
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
e: davelnew...@gmail.com
m: 908-380-8699
s: davelnewton_skype
t: @dave_newton <https://twitter.com/dave_newton>
b: Bucky Bits <http://buckybits.blogspot.com/>
g: davelnewton <https://github.com/davelnewton>
so: Dave Newton <http://stackoverflow.com/users/438992/dave-newton>

Reply via email to