开发者

s:hidden not rendering actual value

开发者 https://www.devze.com 2023-02-14 03:28 出处:网络
My Struts2 form is now rendering almost perfectly, but the s:hidden field is still working incorrectly.In the source code of the generated HTML, the value is being rendered as \"id\", not the actual v

My Struts2 form is now rendering almost perfectly, but the s:hidden field is still working incorrectly. In the source code of the generated HTML, the value is being rendered as "id", not the actual value. Below is the form. Any ideas?

<s:iterator value="bulletins">
    <s:if test="approved == false">
        <s:form action="ApproveBulletin" method="post">
            <table>
                <tr>
                    <td colspan="2"><b>From:</b> <s:property value="name" /></td>
                </tr>
                <tr>
                    <td colspan="2"><b>Subject:</b> <s:property value="subject" /></td>
                </tr>
                <tr>
                    <td colspan="2"><b>Date:</b> <s:property value="date" /> <br>
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><s:property valu开发者_如何转开发e="note" />
                        <s:hidden name="id" value="id" /></td>
                </tr>
                <tr>
                    <td><s:submit type="button" value="approve" label="Approve"
                        action="ApproveBuletin" /></td>
                    <td><s:submit type="button" value="deny" label="Deny"
                        action="DenyBulletin" /></td>
                </tr>
            </table>
            <br />
        </s:form>
    </s:if>
</s:iterator>


Struts tags can be tricky... I think you need to use syntax like this:

<s:hidden name="id" value="%{id}" />

(Then again, I'm not entirely sure why the value attribute is required at all. You might also try and see what happens if you remove it altogether.)


just enter as s:hidden name="id". No need of the value="id"The name would be taken as the value.

0

精彩评论

暂无评论...
验证码 换一张
取 消