【问题标题】:Send parameter value struts1 via <html:link>通过 <html:link> 发送参数值 struts1
【发布时间】:2012-07-22 17:06:49
【问题描述】:

我尝试通过链接将 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>

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

【问题讨论】:

    标签: java struts-1 hidden-field


    【解决方案1】:

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

    【讨论】:

    • 我可以将传递的参数隐藏起来吗?
    • 没有。链接总是发送 GET 请求,GET 的参数总是在查询字符串中。
    猜你喜欢
    • 1970-01-01
    • 2013-06-21
    • 2018-11-24
    • 1970-01-01
    • 2019-07-20
    • 2014-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多