O'Reilly logo

Struts Kick Start by Kevin Bedell, James Turner

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

The Struts Form Bean: HelloForm.java

When a user clicks the Submit button on an HTML form built with Struts, the data from that form is populated into a Java bean called a form bean.

A form bean has properties that match up with all the fields on the form. When the form is submitted, the bean properties are automatically populated. In addition, form beans provide support for automatic data validation and resetting of the bean property values. Listing 3.3 presents the file HelloForm.java, it’s the form bean that’s used to process the form data in our hello.jsp file.

Listing 3.3. The Struts Form Bean for Hello World! (HelloForm.java)
 package ch03.hello; import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; ...

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