response.sendRedirect
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
Hi All,
I am facing a problem while doing this redirection.
I have written two jsp files.
One is pleasewait.jsp and other Quote.jsp
Quote.jsp has for loop iteration.
The flow is from pleasewait to Quote.For each iteration of for loop in quote the loop variable value has to be displayed in pleasewait.jsp and again come back to quote.jsp to start the next iteration..
Can you please give suggestion to do this.I need the count variable value in quote.jsp to be displayed in pleasewait.jsp for each iteration.
I have tried some code please have a look
pleasewait
<form >
<body>
<h1>JSP Page</h1>
<%
if(application.getAttribute("sessionvariable")=="0")
{
response.SendRedirect("Quotesave.jsp")
}
if(request.getParameter("waitCount")!=null)
{
String j="";
int k=0;
j=request.getParameter("count");
System.out.println("Within please wait count"+j);
application.setAttribute("sessionvariable","j");
response.sendRedirect("Quotesave.jsp?");
}
%>
</body>
</form>
Quote.jsp
<%
String j="";
int k=0;
int count=0;
j=(String)application.getAttribute("sessionvariable");
k=Integer.parseInt(j);
for(int m=k; m<3 ;m++)
{
count=m+1;
System.out.println("Count value "+count);
response.sendRedirect("pleasewait.jsp?waitCount=waitCount"+"&count="+count);
}
%>
sessionvariable is global variable initialized to 0
I am facing a problem while doing this redirection.
I have written two jsp files.
One is pleasewait.jsp and other Quote.jsp
Quote.jsp has for loop iteration.
The flow is from pleasewait to Quote.For each iteration of for loop in quote the loop variable value has to be displayed in pleasewait.jsp and again come back to quote.jsp to start the next iteration..
Can you please give suggestion to do this.I need the count variable value in quote.jsp to be displayed in pleasewait.jsp for each iteration.
I have tried some code please have a look
pleasewait
<form >
<body>
<h1>JSP Page</h1>
<%
if(application.getAttribute("sessionvariable")=="0")
{
response.SendRedirect("Quotesave.jsp")
}
if(request.getParameter("waitCount")!=null)
{
String j="";
int k=0;
j=request.getParameter("count");
System.out.println("Within please wait count"+j);
application.setAttribute("sessionvariable","j");
response.sendRedirect("Quotesave.jsp?");
}
%>
</body>
</form>
Quote.jsp
<%
String j="";
int k=0;
int count=0;
j=(String)application.getAttribute("sessionvariable");
k=Integer.parseInt(j);
for(int m=k; m<3 ;m++)
{
count=m+1;
System.out.println("Count value "+count);
response.sendRedirect("pleasewait.jsp?waitCount=waitCount"+"&count="+count);
}
%>
sessionvariable is global variable initialized to 0
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
pass script variable "count" as <%=count%> tag in your redirecting url
posted 18 years ago
-
-
Number of slices to send:Optional 'thank-you' note:
-
-
You have not mentioned what problem you are facing or what exception you are getting. and also when you are retrieving a session object you have to cast it to java.lang.String and when setting a session object cast it to java.lang.Object.
RAGHU<br /> <br />"When the going gets tough, the tough get going"
| Are you okay? You look a little big. Maybe this tiny ad will help: Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing |






