Akhilesh
Akhilesh

Reputation: 1410

Unable to create a link inside the display tag in Struts 2

Please, see the below code. I am not able to generate a link inside the display tag, the attachment attribute is not null, and taskHistory has attachments. With this code I only see http://anyhost.com/user/, and what I want http://anyhost.com/user/attachment

<display:table export="true" id="data" name="taskHistory" pagesize="5"
        requestURI="">

        <display:column title="Download Attachments">
        <a href="/notifier/<s:property value="%{#session.user.userId}" />/<s:property value="%{#data.attachment}" />">Download</a>
        </display:column>
    </display:table>

Upvotes: 0

Views: 999

Answers (2)

Akhilesh
Akhilesh

Reputation: 1410

I found the solution.attr needed to be used for accessing values like below

<display:column title="Download Attachments">
        <a href="/notifier/<s:property value="%{#session.user.userId}" />/<s:property value="#attr.data.attachment" />">Download</a>
    </display:column>

Upvotes: 1

Roman C
Roman C

Reputation: 1

If attachment is an attribute of the action class then

<a href="/notifier/<s:property value="%{#session.user.userId}" />/<s:property value="%{attachment}" />">Download</a>

Upvotes: 0

Related Questions