473,503 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having problem in passing the parameters....

27 New Member
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
4 2489
r035198x
13,262 MVP
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
softwaregeek
27 New Member
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
r035198x
13,262 MVP
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
softwaregeek
27 New Member
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

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

Similar topics

2
17339
by: zlatko | last post by:
There is a form in an Access Project (.adp, Access front end with SQL Server) for entering data into a table for temporary storing. Then, by clicking a botton, several action stored procedures...
12
2781
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
7
2828
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
39
7591
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
7
3295
by: | last post by:
I fail to understand why that the memory allocated in the void create(int **matrix) does not remain. I passed the address of matrix so shouldn't it still have the allocated memory when it returns...
17
3569
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int...
4
2977
by: Mike Dinnis | last post by:
Hi, I've been working through a number of turorials to try to learn more about retrieving data from a SQL database. I think i've mastered techniques where i create a sql string in the page and...
8
1794
by: Brent White | last post by:
If you need more information, I'd be glad to give it, but I am developing an ASPX page so that the user can select multiple values for a specific field, then pass them on (using Crystal Reports 10...
2
1939
by: csmith8933 | last post by:
How do I write a function where the number of parameters it takes varies? This is what I have but it doesnt work. // function prototype void functionThree(int num1=1, int num2=2, int num3=3);...
0
7193
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6975
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5562
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4992
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
371
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.