How to Pass hidden variable using displaytag
I am developing application using spring web mvc..
For displaying purpose i am using displaytag library..
Here is the code for that :
<display:table uid="intf" name="${model.interfacesList}" id="interfacesList" pagesize="5">
<display:column property="id" title="ID" />
<display:column title="Name" property="name"/>
<display:开发者_开发百科column title="IPAddress" property="ipAddress"/>
<display:column title="Network Mask" property="networkMask"/>
<display:column title="Edit" media="html" style="text-align:center;" >
<a href="javascript:submitForm();"><span> <img src="/MailServerV2/images/Btn_edit.gif"/> </span></a>
<input type="hidden" id="id" value="${intf.id}" name="id"/>
<%--<input type="hidden" id="id" value="${model.interfacesList.id}" name="id"/>--%>
</display:column>
</display:table>
At the time of submitting form i am using get method..
in ${intf.id} case : I am getting id as a blank ('') value.
in ${model.interfacesList.id} case : I am getting
java.lang.NumberFormatException: For input string: "id"
Can anybody please tell me how can I pass hidden pass selected ID of particular row ?
Thanks in advance.
use
<input type="hidden" id="id" value="${interfacesList.id}" name="id"/>
You could create a function in your DisplayTag Wrapper that generates the html output and access the request parameters. (assuming ID is in the request, where does it come from?)
HttpServletRequest request = (HttpServletRequest)getPageContext().getRequest();
int lId = request.getParameter("id");
...
out.append("... type='hidden' id='lId' ...);
精彩评论