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?
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails


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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
java cyclic graphs 15 194
unit test DAO layer 1 133
how to exclude a file using regex 5 117
IE doesn't Invoke servlet in iframe 1 94
HOW TO: Upload an ISO image to a VMware datastore for use with VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere Host Client, and checking its MD5 checksum signature is correct.  It's a good idea to compare checksums, because many installat…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now