Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ActionForm returning null in ActionClass

Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP page for which i have written an ActionClass as well as a FormBean.

I have made sure that my struts config file is showing the correct bean. However my form does not show up in the action class i always get a null. Any suggestions on why this could be happening?

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"

<!-- =====START:STRUTS CONFIGURATION FILE 1.1/EN================ -->

<!-- =======START ata Source Configuration================= -->
<set-propertyproperty="description"value="Example Data Source Configuration"/>
<set-property property="minCount"value="2"/>
<set-propertyproperty="url"value="jdbc ostgresql://localhost/mydatabase"/>;
<!-- =======END ata Source Configuration================ -->
<!-- ===========START: Form Bean Definitions=============== -->
<form-bean name="registerationBean" type="com.zerodegrees.struts.forms.auth.RegisterFormBean" />
<action path="/register"
<forward name="success" path="/views/auth/registration.jsp" />

given above is part of my struts config file related to the jsp page i am dealing with.

html:form method="post" action="/register" name="registerForm" type="com.zerodegrees.struts.forms.auth.RegisterFormBean">

is the line is my jsp file

public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
if (form != null) {
RegisterFormBean regForm = (RegisterFormBean)form;
System.out.println ("form is not null buddy");
String fname = regForm.getFirstName();
System.out.println ("the FIRSTNAME is " + fname);


return (mapping.findForward("success"));

is what i have written in the action class which i call RegisterAction.

public class RegisterFormBean extends ActionForm {

----------- is my bean in which i have getter and setter methods. Can anyone throw light on what i have done wrong for my form to return null?

Posts: 67446
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please ask Struts-specific questions in the Web App Frameworks forum. Moving this topic there.
Do you pee on your compost? Does this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic