Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

unable to send huge data from jsp to servlet using doPost  RSS feed

 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using post method for sending some data from jsp to servlet but it takes only 2K of data and moreover for postmethod the browser should not display the content in url
what might be the problem
here is the code i am using in the jsp page


thanking u
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're using the post method but it still looks like you're sending the data in the query string.
Why don't you send it in the post body?

Also, this is not an example of sending data from a JSP to a Servlet.
You're sending data from the browser to the servlet.
[ May 05, 2006: Message edited by: Ben Souther ]
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya u r right i am sending huge data from textarea(browser) to servlet
but unable to send :roll:
anyway the code which i have given in my previous post was from jsp file so i am considering it as sending data from jsp to servlet

what ever,I wanan know the reason why it is taking 2K of data???
can any one tell me the reason???

thanking u
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a limit to how large a query string can be.
It used to be 255 chars, but some browsers will now take more.

Merely specifying that the method is 'post' isn't going to help if you are still embedding the data in the query string.

If you have to build up the name/value pairs with javascript, create hidden input fields, add them to the form, populate them, and then submit the form.
Doing it this way will cause the data to be placed in the body of the post rather than the query string. You won't have to deal with the size constraints and (as a plus) all the data won't show up in the address bar of your browser.

If you need help, with the Javascript, let me know and I'll move this thread to the HTML/Javascript forum.

-Ben
 
saikrishna cinux
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry boss i dont want to use hidden fields in my form , i just want to send the data directly from textarea using javascript function but i dont want to make visible my data in the url but i want to use javascript for url.
is there nay other way for sneding the data with out using hidden fields??

thanx in advance
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use AJAX.
If you need help/examples, of this, let me know and I'll move this thread to the HTML/Javascript forum where the AJAX gurus hang out.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!