• Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionForm returning null in ActionClass  RSS feed

charu latha
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?

Bear Bibeault
Author and ninkuma
Posts: 66263
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!