• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

passing form.serialize() values from jsp to servlet

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Iam calling servlet from jsp using ajax call. Before calling the servlet i use jquery .serialize() method to get all the input values from the form which will help me to pass all the information to the servlet like below:



the above code works fine. But the problem iam facing is when my form has large number of data ie. i have a table and each row has 3 text box, check box and select box. When i have more than 180 rows in the table i get this problem. Since the getParams has larger url string it doesnot call the servlet.

I have this problem only when i have more datas. Is there any other solution to solve this? is there anyother way to call servlet from javascript and pass values from servlet to jsp ?

Please advise.

 
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using jQuery why are you not using jQuery to perform the Ajax call?

In any case, URLs have limited length. Use a POST, passing the info in the request body rather than on the URL.

And, using the jQuery Form plugin will reduce all this code to a single line.
 
Bear Bibeault
Sheriff
Posts: 67753
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanuja Vishwanath wrote:Iam calling servlet from jsp using ajax call.


Actually, you are not.

The JSP is generating an HTML page that is sent to the browser, and that is what is making the Ajax call. None of this has anything to do with JSP, so its been moved to the HTML forum.

You might want to read through this article to understand how JSPs operate.
 
Thanuja Vishwanath
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:If you are using jQuery why are you not using jQuery to perform the Ajax call?

In any case, URLs have limited length. Use a POST, passing the info in the request body rather than on the URL.

And, using the jQuery Form plugin will reduce all this code to a single line.



thanks and it got resolved.

 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Bear mentioned already, why are you not using jQuery's Ajax methods? They are better than what you have there since it handles all of the browser quirks.

Eric
 
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic