O'Reilly logo

Programming Jakarta Struts, Second Edition by Chuck Cavaness

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

What Are ActionForms?

Almost every web application has to accept input from users. Some examples of user input are usernames and passwords, credit card information, and billing and shipping address information. HTML provides the necessary components to render the input fields in a browser, including text boxes, radio buttons, checkboxes, and buttons. When you’re building these types of pages, you must nest the input components inside HTML form elements. Example 7-1 illustrates a very basic sign-in page, similar to the one used in the Storefront application.

Example 7-1. A simple sign-in page

<html>
<head>
<title>Example 7-1. OReilly Struts Book</title>
<link rel="stylesheet" href="stylesheets/main.css" type="text/css">
</head>

<body>

<form method="post" action="/action/signin">

<!-- The table layout for the email and password fields -->
<table BORDER="0" cellspacing="0" cellpadding="0">
<tr>
  <td>Email: </td>
  <td>&nbsp; </td>
  <td>
    <input type="text" name="email" size="20" maxlength="20"/>
  </td>
</tr>

<tr>
  <td>Password:</td>
  <td>&nbsp; </td>
  <td class="alignformslist">
    <input type="text" name="password" size="20" maxlength="25"/>
  </td>    
</tr>
  
<!-- The table layout for the signin button -->  
<table width="250" border="0">
<tr>
  <td>
    <input type="submit" name="Submit" value="Signin" class="Buttons">
  </td>      
</tr>
</table>  
</form>
</body>
</html>

When the user presses the Signin button on the HTML form from Example 7-1, the values within the fields are submitted along with the HTTP request. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required