Ray
Ray

Reputation: 1828

Send parameter value struts1 via <html:link>

I tried to send value of id-property via link as

<html:link action="action?method=view&amp;newsID='<bean:write name="news" property="id"/>'">View</html:link>

or

<input type="hidden" name="newsID" value='<bean:write name="news" property="id"/>'/>
                <html:link
                    action="action?method=view&amp;newsID=${newsID}">
                View
                </html:link>

But nothing work. Can you help me?

Upvotes: 0

Views: 3016

Answers (1)

JB Nizet
JB Nizet

Reputation: 691645

Do yourself a favor, and use the JSTL:

<c:url var="theUrl" value="/action.do">
    <c:param name="method" value="view"/>
    <c:param name="newsID" value="${news.id}"/>
</c:url>
<a href="${fn:escapeXml(theUrl)}">View</a>

Upvotes: 4

Related Questions