File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes doPost() method problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doPost() method problem" Watch "doPost() method problem" New topic
Author

doPost() method problem

Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
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

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

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


SCJP, SCWCD.
|Asking Good Questions|
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Monoj Roy
Ranch Hand

Joined: Oct 10, 2007
Posts: 98
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

Joined: Dec 11, 2004
Posts: 13410

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

Joined: Dec 11, 2004
Posts: 13410

Would you like this thread moved to our HTML/Javascript forum where you can get better help with Javascript issues?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doPost() method problem