File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Posting a jquery array to JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Posting a jquery array to JSP" Watch "Posting a jquery array to JSP" New topic

Posting a jquery array to JSP

Abhilash Chander
Ranch Hand

Joined: Oct 18, 2009
Posts: 39
Hi All,

I am using jquery on my front end for a shopping cart application. After the cart is filled, on pressing save button the data will be saved into the database through a JSP.

Below I built the array from my cart items using jquery :

Then I post my array from jquery to JSP page 'SaveOrderDetails.jsp' as shown below :

Below are the parameter names I am getting on the JSP page :


As they are individual parameters, how can I fetch them as a two dimensional array instead of individual parameters. Because count of array is going to vary with number of items added to the cart.

My attempt to fetch the array on JSP page :

Hope you guys can take some time to help. Thanks for your help in Advance.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63866

First of all, Java code should be in a servlet, not a JSP.

Secondly, you might look into the commons beanutils project for help with converting complex params to beans and lists.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Posting a jquery array to JSP
jQuery in Action, 3rd edition