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
Post a Comment