通过<html:link> </html:link>发送参数值struts1

时间:2012-07-22 17:06:49

标签: java struts-1 hidden-field

我尝试通过链接发送id-property的值为

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

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

但没有任何效果。你能帮助我吗?

1 个答案:

答案 0 :(得分:4)

帮自己一个忙,并使用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>