I'm seeing some weird behavior in ActionSupport.getText() that is causing me
some problems in Struts 2.0.14.  From the docs (and my previous experience),
getText() retrieves entries from the resource bundle's associated with the
application.  But for some reason, in my current instance it's trying to
evaluate the resource bundle key as an OGNL expression.  Am I doing
something wrong?

In my application.properties file I have:

chart.netFrameSales.title=Net Frame Sales

In my ChartNetFrameSalesAction I have:

  public JFreeChart getChart () {
    String title = getText("chart.netFrameSales.title");

which is causing infinite recursion because OGNL is seeing the "chart." and
going to the value stack, calling getChart() and round and round we go.

The Relevant part of the stack trace shows:

[2010-03-23 11:10:47,307] WARN  {abcOu3jlPU3Rf_9tFPSzs}
OgnlValueStack.logLookupFailure: Caught an exception while evaluating
expression 'chart' against value stack
Caught an Ognl exception while getting property chart - Class:
ognl.OgnlRuntime
File: OgnlRuntime.java
Method: getMethodValue
Line: 1416 - ognl/OgnlRuntime.java:1416:-1
    at
com.opensymphony.xwork2.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:106)
    at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2210)
    at ognl.ASTProperty.getValueBody(ASTProperty.java:114)
    at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
    at ognl.SimpleNode.getValue(SimpleNode.java:258)
    at ognl.Ognl.getValue(Ognl.java:494)
    at ognl.Ognl.getValue(Ognl.java:458)
    at com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:190)
    at
com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.java:228)
    at
com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:431)
    at
com.opensymphony.xwork2.util.LocalizedTextUtil.findText(LocalizedTextUtil.java:293)
    at
com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:173)
    at
com.opensymphony.xwork2.TextProviderSupport.getText(TextProviderSupport.java:88)
    at com.opensymphony.xwork2.ActionSupport.getText(ActionSupport.java:71)
    at
com.vsp.global.controller.ChartNetFrameSalesAction.getChart(ChartNetFrameSalesAction.java:84)


Is this a misconfiguration on my part, or bad documentation around the
ActionSupport.getText() method?
  (*Chris*)

Reply via email to