Javatpoint Logo

Pass value from JSP-to-JSP

By: chanch*** On: Sun Apr 09 01:11:27 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
I have a list of student_details in a table(suppose, ViewList.jsp) & to edit each data ...I have provided a link which when selected the details from that particular row will been passed to another " jsp page".
And I have set this as the "PreActionPage.jsp", juz to fetch the new values from User(except "user_id").


Currently I can pass all the new_values like (name,address,email,pass...etc)....to the FinalActionPage.jsp using <form action="FinalActionPage.jsp> tag................but ,howdo I pass the 'id' (which is a constant throughout) to FinalActionPage.jsp.

-------------------------------------------------------------------------------------------------------------------------
The follown are the JSP Pages :



1. View.jsp
-------------

<tr>
<td><%out.println(rs.getInt("course_id")); %></td>
<td><%out.println(rs.getString("course_name")); %></td>
<td><%out.println(rs.getInt("course_duration")); %></td>
<td><%out.println(rs.getString("course_tutor")); %></td>
<td><%out.println(rs.getLong("course_fee")); %></td>


<td>
<a href="PreActionPage.jsp?course_id=<%=rs.getInt("course_id")%>&course_name=<%=rs.getString("course_name")%>&course_duration=<%=rs.getInt("course_duration")%>&course_tutor=<%=rs.getString("course_tutor")%>&course_fee=<%=rs.getLong("course_fee")%>">Edit
</a>
</td>
</tr>




2. PreActionPage.jsp
--------------------------------

<form action="FinalActionPage.jsp">
<TABLE border="4">
<tr >
<th bgcolor="red">Course_ID</th>
<th>Course_Name</th>
<th bgcolor="red">Course_Duration</th>
<th>Course_Tutor</th>
<th bgcolor="red">Course_Fee</th>
</tr>

<tr>
<td> <%out.println(course_id); %> <!--DOUBT-->
<input type="hidden" name="course_id" > <!--DOUBT-->
</td>
<td><input type="text" name="newname" value="name"/></td>
<td><input type="text" name="newduration" /></td>
<td><input type="text" name="newtutor" /></td>
<td><input type="text" name="newfee" /></td>
</TABLE><input type="submit" value="Save"/>
</form>




3.FinalActionPage
------------------------
Que:
How do I get the values from PreActionPage.jsp to here?
:/ <!--HELP-->
Up0Down
jsp  x  93Tags