Search code examples
javajspstruts2ognl

variable using ognl expression within id doesn't display value


Hi this seems to be a weird issue since the variable works when I print it out through s:text tag but when I put it in the id tag it doesn't work.

The id in div would literal print out %{param} but s:text would print out the value of the param variable. Am I missing something here? Any advice or suggestion be great!

<s:set var="param" value="%{parameters.param}"/>
<div id="%{param}">
    <s:text  name="%{param}"/>
</div>

Solution

  • Maybe something like this will work:

    <div id="<s:property value='param'/>">
    

    UPDATE

    Below is the real solutions:

    <div id="<s:property value='%{param}'/>">