Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

doPost() method problem

 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a blank form and sending data from javascript to the servlet with the help of the form here below is the code

URL=URL + "&header_hsmChanceGrid="+header_hsmChanceGrid;//and so on

document.myForm.method="POST";
document.myForm.action=URL ;
document.myForm.submit();


Now when I am sending huge data in the URL my servlet is not getting invoked.
but with less data I can get the data in my servlet .


Can anybody have any idea how to pass thease data to my servlet ? Am I doing something wrong POST can manage the data right?Please help
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

URL=URL + "&header_hsmChanceGrid="+header_hsmChanceGrid;//and so on

This looks like you are passing parameters as part of the URL? That's not going to work with POST, which doesn't read parameters from the query string.
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now when I am sending huge data in the URL my servlet is not getting invoked.
but with less data I can get the data in my servlet .


What makes you think that the servlet is not getting invoked with large data.
maybe its only taking more time
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are limits to what some browsers will send on the queryline.
Initially, the limit was 255 chars. Most browsers allow more than that these days but the querystring is still a poor choice for passing anything but small and predictable amounts of data.

Move that data into the body of your post and you won't need to worry about bumping into a limit.
 
Monoj Roy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having the data in the javascript level not in the form
I am using the form just to send the data to my servlet .As you are telling me to put the data in the body how can I put the data in the body from the java script?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Monoj Roy:
I am having the data in the javascript level not in the form
I am using the form just to send the data to my servlet .As you are telling me to put the data in the body how can I put the data in the body from the java script?


You can do that by creating an HTML form and using Javascript to submit it.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Would you like this thread moved to our HTML/Javascript forum where you can get better help with Javascript issues?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic