简体   繁体   中英

pass parameter from jsp to servlet hidden

This is my code in choose.jsp

<ul class="nav nav-pills  nav-stacked ">
<li>
<form action="persom" method="post">
<input type="hidden" name="hidden" value="<%= request.getParameter("eno") %>">
<input type="submit" value="PC">
</form> 
</li>
<li>Printer</li> 
<li>Scanner</li>
</ul

This is the code in servlet

String employee_num = request.getParameter("hidden") ;
PrintWriter pw= response.getWriter();
pw.println("<h2> " + employee_num + "</h2>"); 

It is returning null as output. The value I'm passsing is from servlet through which i invoked the choose.jsp, please help.

I think parameter from servlet may be coming as Null . Do one thing receive parameter in a variable some where else on the jsp page , and print it . Check if it is coming null from servlet side only or not . And if it is not null, just pass variable in the value field as, let's say <%=empNo%> .Let me know if that works :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM