sending array as request parameter

I have a jsp page which has a link that takes sends some request parameters to a servlet.

<a href="/servlet?reqParam=paramValue">Click on the Link</a>

My task is to send an array as parameter so that in servlet i can retrieve them as request.getParameterValues("reqParam");

I have already loaded the javascript array, i couldnt figure how to send that javascript array as parameter.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

String ans[] = request.getParameterValues("ans");

if sending to db

//extract from my program
for(int i=0;i<ans.length;i++)
PreparedStatement stmtadd = C.prepareStatement("insert into answer values('"+ans[i]+"',now(),0,?)");
soft_techyAuthor Commented:
Yes, but how can i send the array ans[] from my JSP as part of link?
sorry, i used a form and a submit button instead.
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

var arr = [11,22,33,44];
function sendArray(){
                     document.arrForm.p.value = arr;
<form name="arrForm" action="<%=request.getContextPath()%>/yourServlet" method="post">
<input type="hidden" name="p"/>
<a href="javascript:sendArray()">Click on the Link</a>  
and in your servlet use,
         PrintWriter out = response.getWriter();
         String[] pa = request.getParameterValues("p");  
         for(int i=0;i<pa.length;i++){

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
you can use something like this:
<a href="yournextjsp.jsp?darray=ans[]">your link here</a>

then when your in the next jsp page:
 String[] myarr=request.getParameterValues("darray");

hope i helped you on this one.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.