You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John M Flinchbaugh <jo...@hjsoft.com> on 2007/04/30 22:33:15 UTC

accessing ognl from jsp 2.0 el?

In webwork, I had become accustomed to having a getXyz() method on an
action, and being able to just access it in jsp as ${xyz}.  The ability
was just built in, per:
http://wiki.opensymphony.com/display/WW/Using+WebWork+and+XWork+with+JSP+2.0+and+JSTL+1.1

Struts 2 has this same page without the note about it being automatic:
http://struts.apache.org/2.x/docs/using-struts-and-xwork-with-jsp-20-and-jstl-11.html

Is the Struts doc up-to-date?  Is it really required that I expose them
manually?  Here's where it gets wierd: 

I've had to look this all up, because I've seen in Struts 2.0.6 evaluate
${xyz} just fine without any extra work, just as I had seen in webwork,
but it doesn't work reliably.  At times, I'll reload, and see all the
ognl values (referenced as el) disappear from the screen!  What is
happening?!  Reload a couple more times, and they come back!  It's quite
perplexing.  

Putting a <s:set name = "xyz" value = "xyz"/> makes it stick reliably.  
Using ognl-aware tags also work reliably.  I found this hint here:
http://struts.apache.org/2.x/docs/exposing-framework-objects-to-jstl-with-a-jstl-and-displaytag-example.html

Thanks for any help you may be able to provide.
-- 
John M Flinchbaugh
john@hjsoft.com