Array in query string

Posted on 2002-07-29
Last Modified: 2008-03-17
hai friends,
is it possible to send array variables through
query string.if so,kindly give me the syntax.
(i.e)i am having an array in test1.jsp.without submit the
form i required these array values in next jsp (test2.jsp).i couldn't
use session in my program.i think only possible way is using
query string.but i don't know the me if anybody know the answer.

Question by:Marysweety
LVL 33

Expert Comment

ID: 7185230
you could pass the array on the query string as seperate values ... but if you are going to do this, I would use POST instead of GET (query-string) because the query-string can only be used for a limited amount of data.  Show us your code ...
LVL 18

Accepted Solution

bobbit31 earned 25 total points
ID: 7185377
you could set a property in the servlet context, something like this:

in jsp1,
getServletContext().setAttribute("MyKey", arrVal);

in jsp2,
arrVal = (String[]) getServletContext().getAttribute("MyKey");

to remove it from the servlet context:
getServletContext().setAttribute("MyKey", null);

Expert Comment

ID: 7186979
>>i couldn't use session in my program
May I know why you can't use session?
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.


Author Comment

ID: 7187356
hai kotan,

i am just revamping the created project.they have already

used session and made many checking in more than 45 files.

so,if i use session i would be make some tiny corrections

in all that only i tried to avoid session variables.

thx for yr reply.

Mary sweety.

Author Comment

ID: 7187361
hai bobbit31,
thanks a lot.Now I could easily pass array values using set properties of
the servletcontext,which is suggested by you. It is working fine.

LVL 18

Expert Comment

ID: 7188933
> thanks a lot.Now I could easily pass array values using set properties of
the servletcontext,which is suggested by you. It is working fine.

then why the 'B' grade?

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question