| Author |
doPost() processes - doGet() displays
|
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
I'm trying to go for my SCWCD and am just starting to learn servlets. In most of the books I'm reading and most of the examples I've seen, static HTML pages with forms call the doPost() method of the servlet. When I'm writing the code I make the doGet() method generate the form that calls the doPost() method of the same servlet. I'm wondering what reason there is not to have the doGet() generate the form that calls the doPost(), since I haven't seen it in any examples... -Nate
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14475
|
|
|
Odd. I have. Maybe it just got less popular after JSPs and MVC-patterned app structures took over.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Jessica Sant
Sheriff
Joined: Oct 17, 2001
Posts: 4313
|
|
I would think its more a question of design... I usually like to have a servlet perform one action -- say handle a particular form. And another page (maybe a JSP or HTML) create the form. -- Plus writing out tons of HTML code in a servlet is a pain... all those out.println("..."); statements... whereas in a JSP you can simply write the HTML. The other point in the argument is from a mainteance stand point... it might be harder to maintain if you have one giant servlet that creates the form and handles the input, rather than two pieces that handle the same thing... Just some thoughts...
|
- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
|
 |
Amir Kamran
Ranch Hand
Joined: Apr 21, 2002
Posts: 48
|
|
when we use simple form of html and want some dynamic behaviour in reply of the form, it is easy to use simple html file to display form and a servlet which handles it. But it is not a rule. I think, it is good to generate the forms from within a servlet b/c it increase the functionality of the form as we can make the forms dynamic too.
|
 |
 |
|
|
subject: doPost() processes - doGet() displays
|
|
|