File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes doGet method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet method" Watch "doGet method" New topic

doGet method


Joined: Oct 24, 2005
Posts: 4
how to make doGet method not to appended message to URL as in the case of doPost
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
The doGet() method in a servlet corresponds to the GET method in the HTTP protocol (IETF standard, RFC 2616). Its primary role in life is to request some thing from a server. It is notreally designed to send data to the server, although it is possible to send a small amount. If you do send data to the server via the GET method, it will be appended to the URL. There is no work around to this.

For futute reference, take a look at the HTTP method definations.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

The doGet method is not appending the querystring variables.
The browser is.

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

Joined: Nov 06, 2000
Posts: 1510
If you don't want the data to show up in the URL, just use POST. of course, that means you will have to create a form if you are not already using one.

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: doGet method
jQuery in Action, 3rd edition