Struts Tutorial Home

Struts Home

JSP Resources

Community

Site

 


In our LoginAction,we retrieved the form values using the conventional methods in HttpServletRequest. Struts provides an easy way to retrieve these values with the help of form beans. A form bean is a simple JavaBean that extends from org.apache.struts.action.ActionForm. We already have a JavaBean “User” but that does not extend from ActionForm. We can reuse this JavaBean for this purpose. Let’s add the extends clause to the User class so that the signature of the class becomes

public class User extends ActionForm

Also we need to add a no-argument constructor to the User class to enable the struts framework to instantiate the bean.

public User(){
          super();


}

                    

Copyright © 2010 VisualBuilder. All rights reserved