This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes doGet() vs doPost() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "doGet() vs doPost()" Watch "doGet() vs doPost()" New topic
Author

doGet() vs doPost()

Lucky Singh
Ranch Hand

Joined: Jan 19, 2004
Posts: 125
I have an HTML form (Welcome.html).
On submitting the form, I call goGet() of servletA.
doGet() of servletA displays another form (Data) and calls doPost() to service the request enetred in this form.
Afetr completeion of the request, control returns to doGet() and once again displays form (Data).
And so on...
Will I need doGet() and doPost() both or can just 1 method take care of everything?
If I want to print say an Array of integers got by processing form Data,
how would I display it in HTML using the servlet?
Gauri Horane
Greenhorn

Joined: Dec 25, 2003
Posts: 8
To display array of integers u first convert each integer into String & insert it i html
for e.g 's'(for e.g. s="11") is string containing integer value then u have to write
out.print("<html><body>"+s+"</body></html> ;
 
Don't get me started about those stupid light bulbs.
 
subject: doGet() vs doPost()