File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Posting a jquery array to JSP

 
Abhilash Chander
Ranch Hand
Posts: 39
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :

orderDetails[2][gender],
orderDetails[2][price],
orderDetails[0][gender],
orderDetails[0][price],
orderDetails[2][name],
orderDetails[1][gender],
orderDetails[1][name],
orderDetails[1][price],
orderDetails[0][name]


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
Marshal
Pie
Posts: 64192
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic