Home > Articles

Creating HTML Forms

  • Print
  • + Share This
This chapter is from the book

Forms are an important aid to making the Web interactive. With JavaServer Pages, handling forms is easy—they do most of the work required to get to the information submitted with a form. Sometimes, constructing the form itself is more work than writing the handler.

Information from forms is submitted using either the GET or POST request methods. You can construct the equivalent of a GET request by appending a "?" along with the name-value pairs for each variable. This is very useful for testing handlers and can save you quite a bit of time.

JSPs and servlets can give you information about form parameters, including their name and values. If a parameter name occurs more than once in a submission, you can use the method getParameterValues to get to each instance. As you would naturally expect, the way you use servlets to handle form submissions is fundamentally the same. Several combinations of forms and handlers are available for you to use in your application. Now that you have some experience with using JSP and servlets to build and handle forms, you can select the most appropriate for your needs and preferences.

  • + Share This
  • 🔖 Save To Your Account