In this excerpt from chapter 4 of Joel Murach's Java Servlets and JSP, you'll learn how to develop a web application that consists of HTML pages and JavaServer Pages (JSPs). As you will see, JSPs work fine as long as the amount of processing that's required for each page is limited. When you complete this chapter, you should be able to use JSPs to develop simple web applications of your own.
When you code a Form tag that requests a JSP, you can code a Method attribute that specifies the HTTP method that's used for the request. The Get method is the default HTTP method, but the Post method is also commonly used.
Figure 8 presents the pros and cons of using the Get and Post methods. With either method, you can still test the page by appending the parameters to the URL string. So the question really comes down to selecting the appropriate method for the finished web application.
If the HTML form only needs to transfer 4 KB of data or less.
If it's okay for the parameters to be displayed in the URL.
If you want users to be able to include parameters when they bookmark a page.
When to Use the Post Method
If you're transferring over 4 KB of data.
If it's not okay for the parameters to be appended to the URL.
The visible difference between the Get and Post methods is the URL that's displayed in the browser. For Get requests from an HTML page, the parameters are appended to the URL. For Post requests, the parameters are still sent, but they're not displayed in the browser.
You can test a JSP that uses either method by appending the parameters to the URL.
Remember: this is from chapter four ofJoel Murach's Java Servlets and JSP (Mike Murach & Associates, ISBN 1890774189, 2003). Grab a copy at your favorite book store today!