Hi Matt,

Firstly, I've changed the subject to make it easier for people to find a 
solution to this kind of problem in the future.

Secondly, I've added a bit to the 2.0.1 release notes 
(http://appfuse.org/display/APF/Release+Notes+2.0.1) to maybe help prevent 
others 
from being tripped up by this problem in the future.

I've successfully converted my JSTL expressions, but would be grateful for any 
comments on the way I've done it - see below.

On 11 Jan 2008 at 13:41, Rob Hills wrote:

> On 10 Jan 2008 at 21:34, Matt Raible wrote:
> 
> > I'm assuming you're using JSTL expressions - i.e. ${...}. If so,
> > Struts recently changed to only allow OGNL expressions to prevent
> > security issues. If you can post your expressions, we can try to help
> > you translate them into OGNL expressions.
> > 
> > http://issues.appfuse.org/browse/APF-941
> 
> Thanks for the reply.  I'd not seen it before I sent my last post on this 
> one, so 
> please ignore that.
> 
> The expressions are JSTL ones.  Now that I understand the problem, I'll 
> have a go at converting the expressions to OGNL.  If I have a further 
> problem, I'll report back, otherwise I'll report what I did to fix it.

The first expression I had a problem with is one that pulls a value from my 
java Constants class.  The original expression was:

headerKey = ${Constants.SELECT_ALL}

I note that the appfuse:constants tag makes constants available as a simple 
jstl ${simpleClassName.CONSTANT} expression.  After 
reading the Struts 2 basic OGNL page again 
(http://struts.apache.org/2.0.9/docs/ognl-basics.html ), I changed my headerKey 
to:

headerKey = [EMAIL PROTECTED]@SELECT_ALL}

and this fixed that problem (I've created my own Constants file that extends 
org.appfuse.Constants).  However, is there a better way?  
Does the appfuse:constants tag also expose Constants to OGNL in a "tersely" 
accessible way the way it does for JSTL?

For my second problem, the original expression was:

<s:text name="${driversShifts.startLocation}"/>

The variable driversShifts is from a <display:table .. id="driversShifts" ..> 
tag and "startLocation" is one of the attributes of the 
"driversShift" objects being iterated over by display:table.  I'm actually not 
sure now why I had an <s:text ..> tag to display this variable's 
value as it was not inside the attribute of another tag so I was simply able to 
replace it with:

${attr.driversShifts.startLocation}

However, it could have been that this needed to be inside a Struts2 tag and so 
it would be good to know what OGNL expression I could 
have used to access this variable.

Cheers,

Rob Hills
Waikiki, Western Australia
Mobile +61 (412) 904-357
Fax: +61 (8) 9529-2137

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to