By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,619 Members | 2,309 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,619 IT Pros & Developers. It's quick & easy.

Having problem in passing the parameters....

P: 27
hi to all,

I am having some problem in passing parameter.....

My code looks like:::

request.setAttribute("game",game);
response.sendRedirect("profile.do?operation=select &max_profiles="+totalprofiles+"&fsa="+fsa+"&score= "+score+"&gameid=" + gameid + "&locale="+locale);


I simply want to pass the value of game parameter which contains name of the game i.e. "chess" on next JSP page.I am able to retrive value of ,rest of the parameters on next page.I also tried to append the game parameter in response.sendRedirect as other parameters but exactly when it excutes that line it gives some error.

but if i pass it in this way as shown above it excutes properly but on the JSP page i m not able to get the value of game...but got rest all values.

when i do system.out.println("game" + game); then i am getting game value ,its length is also proper and very next line is the code shown above
dont find what's the catch??

Question 1:
Is it possible to use request.setAttribute() and response.sendRedirect() simultaneously??


is there any other way to do so???


thanx...
Jun 21 '07 #1
Share this Question
Share on Google+
4 Replies


10K+
P: 13,264
hi to all,

I am having some problem in passing parameter.....

My code looks like:::

request.setAttribute("game",game);
response.sendRedirect("profile.do?operation=select &max_profiles="+totalprofiles+"&fsa="+fsa+"&score= "+score+"&gameid=" + gameid + "&locale="+locale);


I simply want to pass the value of game parameter which contains name of the game i.e. "chess" on next JSP page.I am able to retrive value of ,rest of the parameters on next page.I also tried to append the game parameter in response.sendRedirect as other parameters but exactly when it excutes that line it gives some error.

but if i pass it in this way as shown above it excutes properly but on the JSP page i m not able to get the value of game...but got rest all values.

when i do system.out.println("game" + game); then i am getting game value ,its length is also proper and very next line is the code shown above
dont find what's the catch??

Question 1:
Is it possible to use request.setAttribute() and response.sendRedirect() simultaneously??


is there any other way to do so???


thanx...
The simplest way to submit data from a JSP is through a form. Use a simple HTML form and pass the name of the game as a hidden input then you can use request.getParameter in the next JSP.
Jun 21 '07 #2

P: 27
The simplest way to submit data from a JSP is through a form. Use a simple HTML form and pass the name of the game as a hidden input then you can use request.getParameter in the next JSP.

sorry for lack of information...

We are using spring framework. The code snippet which i mentioned is written in controller class that is java (.java) file..and that controller call the JSP page...we are not able to pass the game value to JSP page from controller using the code shown above.

Is there any problem in above code??

Thanx...
Jun 21 '07 #3

10K+
P: 13,264
sorry for lack of information...

We are using spring framework. The code snippet which i mentioned is written in controller class that is java (.java) file..and that controller call the JSP page...we are not able to pass the game value to JSP page from controller using the code shown above.

Is there any problem in above code??

Thanx...
Is your controller a servlet?
Try
Expand|Select|Wrap|Line Numbers
  1. request.getRequestDispather("/jspPath.jsp").include(request, response);
Jun 21 '07 #4

P: 27
Is your controller a servlet?
Try
Expand|Select|Wrap|Line Numbers
  1. request.getRequestDispather("/jspPath.jsp").include(request, response);

Thanx....

it worked but with little modification . I use forward in placeof include..
Did you find out why it didnt work with response.sendRedirect()?
Any specific reason why when i add game parameter then only it fails?? or when i pass it through request.setAttribute() then i cant retrieve it on JSP.

Cant we use both simultaneously??
Jun 21 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.