html - How to pass hidden values using form in jsp -


my code follows

<form method="post" action="answer.jsp">     <input type="submit" value="answer">     <%string q_id=rs.getstring("q_id"); %>     <input type="hidden" value="<%out.print(q_id);%>">  </form>  

i want pass q_id page answer.jsp got value of q_id didn't understand how pass (or using different method) value?

in jsp form you'll need

<form method="post" action="answer.jsp">     <input type="hidden" name="q_id" value="<%= rs.getstring("q_id") %>">     <input type="submit" value="answer"> </form> 

then can receive q_id in answer.jsp as

<p>question id: <%= request.getparameter("q_id") %></p> 

or, using jsp el (recommended)

<p>question id: ${param.q_id}</p> 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -