This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Pass value to update jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Pass value to update jsp" Watch "Pass value to update jsp" New topic
Author

Pass value to update jsp

michael yue
Ranch Hand

Joined: Nov 20, 2003
Posts: 204
Hi, I am doing some process in a servlet such as inserting and I want to display the number of records that have been inserted from time to time in JSP page. I found that it can be done using following code in JSP.
<%
for (int x=0; x<100; x++) {
%>
<b>X is now <%=Integer.toString(x)%></b><br>
<%
out.flush();
try { Thread.sleep(1000); } catch (Throwable t) {}
}
The problem now is that I want to pass the number value which is the number of records inserted to the JSP from servlet. But if I use the following code to pass data
res.sendRedirect("https://"+host+"/webpost/crn/cncreate.jsp?insnum='"+strnum+"'");
with variable insnum being the number passed, I think after the value is passed the JSP will display the insert status one time only and not continue to update itself. I do not want to put all the insert coding into jsp page. Any ideas? Thanks.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Pass value to update jsp
 
Similar Threads
insertion of checkbox values from jsp to database
Passed Part One with 87%
Problems with servlet-mapping to redirect some JSPs...
displaying results after retriving from db
IBM 154 q&a passed: 66.7%