Search code examples
jspstruts2displaytagognl

Unable to pass a parameter through <s:a> in DisplayTag


<display:column title="Edit Here">
   <s:url id="url1" action="editAction">
   <s:param name="id">
      <s:property value="news.id" />
   </s:param>
   </s:url>
   <s:a href="%{url1}">Edit</s:a>
</display:column>

id is property in my action class,zero is being passed everytime rather than the corresponding id of the table.


Solution

  • Change this

    <s:param name="id">
        <s:property value="news.id" />
    </s:param>
    

    to this:

    <s:param name="id" value="#attr.news.id"></s:param>
    

    It should be enough.

    #attr is the OGNL used to access the pageContext (then request, session and application scopes).