How to access static fields using OGNL in Struts 2
Andrei Antonescu
Ranch Hand
Joined: Jul 08, 2010
Posts: 75
posted
0
Hello,
I am having a class that contains the "public static final x" variable. How can I use it into a OGNL expression in a web page using Struts 2 tags?
I would like to achieve smth like this:
Actually, it doesn't say anything about not being able to access static variables on that page. What it *does* say is that the *method* can't be static, but I don't think that's correct either: if you're configured to allow static access and use the OGNL static access syntax, it'll work. It's okay if you don't believe me, though.
Also, when linking to the online docs, make sure you link to (a) the most recent version (or version-specific when the version is known), and (b) not the cwiki.apache.org site, but rather the struts.apache.org site. Thanks.
Andrei Antonescu
Ranch Hand
Joined: Jul 08, 2010
Posts: 75
posted
0
Hello,
Thanks for posting. The solutions were very good. All of them worked.
Thanks again.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: How to access static fields using OGNL in Struts 2