How to pass a hidden variable using displaytag

I am developing an application using spring web mvc ..

I use displaytag library to display the target ..

Here is the code for this:

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

While submitting the form, I use the get method.

in the case of $ {intf.id}: I get id as an empty ('') value.

in the case of $ {model.interfacesList.id}: I get

java.lang.NumberFormatException: For input string: "id"

Can someone please tell me how can I pass the hidden pass of the selected id of a specific row?

Thanks in advance.

+3
source share
2 answers

using

<input type="hidden" id="id" value="${interfacesList.id}" name="id"/>
+2
source

DisplayTag Wrapper, html . ( ID , ?)

HttpServletRequest request = (HttpServletRequest)getPageContext().getRequest();

int lId = request.getParameter("id");
...
out.append("... type='hidden' id='lId' ...);
+1

Source: https://habr.com/ru/post/1721690/


All Articles