Java Reference
In-Depth Information
After dragging the form element from the palette and dropping it into the page the
following window pops up:
At this point we need to enter an action for the form, the action is the URL that will
be executed when the form is submitted. In this case we will execute a JSP called
output.jsp . We also need to select a method to use for the HTTP request generated
when our form is submitted; valid methods are GET and POST. In this case we will
use the default GET method; had we selected POST, we would also have had to se-
lect an encoding for the form. Unless our form has a file upload field, the encoding
should always be the default application/x-www-form-urlencoded. One more field
we can optionally enter is the name for our form.
GET and POST are generally used for different reasons; GET methods are
typically used for retrieving data or for bookmarkable pages and POST
methods are typically used for modifying data.
After dropping the form into the page and formatting the code ( shift+alt+F ), its
markup should now look like this:
<%@page contentType="text/html" pageEncoding="UTF-8"%> <!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Developer Survey</title>
</head>
<body>
 
Search WWH ::




Custom Search