I have this jsp page called email.jsp where it retrieves the array from a different page. It looks like below:

email.jsp:

String[] array = request.getParameter("arrayList").split(",", 0);

Now debugging array returns this format:

array:{"fileid1","hash1","fileid2","hash2",....}

which is fine. And I want to pass this value to another page using ajax like this:

$.ajax({
               url: 'sendemail.jsp',
               type: 'POST',
               data: {

                   arrayList:"<%=array%>"


               },

And in my sendemail.jsp,i would retrieve it like this:

 String[] split = request.getParameterValues("arrayList");

The issue here when I debug is split returns some kind of value like [Ljava.lang.String;@c47alf]. How do I ensure it returns identically like array?

Edit

  String[] split = request.getParameterValues("arrayList");

              // use a loop to update recipient
            for(int i=0;i <split.length; i = i + 2) {

                fileFacade.updateRecipient(Long.valueOf(split[i]), split[i + 1], recipient);
            }

I need to loop the method to pass first two elements in the array to the method parameters,and then repeat.

0 Answers