struts2variable-assignmentognlstruts-tags

How to assign the output of <s:date> to a variable with <s:set> tag in Struts 2?


I'm looking for:

<s:set var="A_VARIABLE" value="<s:date name='OBJECT.MEMBER' format='XXX_FORMAT'/>"/>

Then, I want to manipulate #A_VARIABLE, but A_VARIABLE is not getting value from <s:date>.


Solution

  • You cannot nest tags like that. Use <s:set> tag with body content. Put your <s:date> tag inside <s:set> tag.

    <s:set var="A_VARIABLE">
      <s:date name="OBJECT.MEMBER" format="XXX_FORMAT"/>
    </s:set>