java
  • struts-1
  • hidden-field
  • 2012-07-22 62 views 0 likes 
    0

    我試圖通過鏈路發送ID屬性的值通過<html:link>

    <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> 
    

    但是,沒有什麼工作發送參數值struts1中。你可以幫我嗎?

    回答

    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> 
    
    +0

    能做些什麼傳遞的參數爲隱藏? – Ray 2012-08-03 05:49:57

    +1

    否。鏈接始終發送GET請求,GET的參數始終位於查詢字符串中。 – 2012-08-03 05:55:02

    相關問題