0

I upgraded to struts 2.3.16.3 from 2.3.4.1 in my project and the following tag stopped working.

<s:param name="%{#key}" value="%{#keyValue}"/>

The param is being used inside a s:url tag. The name part is getting evaluated but the value is not evaluated and shows up as the text "keyValue" inside the url in page. This tag is in a contact jsp which gets included in other jsps. The key and keyValue are defined in the parent jsp.

For example, <s:set var="key" value="'billToId'" /> <s:set var="keyValue" value="'%{billToId}'"/>

I tried setting the following constant in struts.xml but it did not resolve the issue.

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

I have put in a workaround for this issue but is there any way to read the value from value stack using this ognl expression.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

2 Answers2

0

I don't remembered a time since param tag became accepting values of type String only. It could be a bug, but actual parameter values type should be converted to String type. See also Suppress empty parameters using param tag.

Community
  • 1
  • 1
Roman C
  • 49,761
  • 33
  • 66
  • 176
0

Are you using jsp:include or s:include ?

@AndreaLigios <%@ include file="/WEB-INF/jsp/contact/listContacts.jspf"%> is being used

<%@ include is the static include directive, while you should use the dynamic <jsp:include/> tag, or even better, since you are using Struts2, the <s:include/> tag.

Read more on this detailed answer.

Community
  • 1
  • 1
Andrea Ligios
  • 49,480
  • 26
  • 114
  • 243
  • Tried using s:include. Now it looks like its trying to evaluate the expression. But I'm getting something like billToId=%25%7BbillToId%7D for the value. It is getting the key instead of keyValue. – kthananjayan Nov 04 '14 at 16:03
  • billToId.value ? What is that object, btw ? Completely unclear, but it seems you did the first correct step. – Andrea Ligios Nov 04 '14 at 16:06
  • It's the key that is being set in the parent jsp. The key is coming back for keyValue as well. . For some reason, the expression %{billToId} is not getting evaluated. – kthananjayan Nov 04 '14 at 16:50