You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Peter Pilgrim <pe...@db.com> on 2001/09/26 12:12:39 UTC

Re: JSP is not creating and/or populating an action form? [SOLVED]


Oh! You have been a naught boy! Please take this white chalk write on the
"Java" blackboard

[
      I MUST MAKE SURE THAT MY JAVA BEANS REALLY DO DERIVE
     FROM THE STRUTS ACTIONFORM CLASS IF THE ACTIONSERVLET
     IS TO CREATE AND INSTANTIATE THEM!

] x 10


Here is the extract of struts-config.xml

  <form-beans>
    <form-bean      name="deptForm"                    type="com.db.moar.jsp.beans.Dept" />^
     ...
  </form-beans>

  <global-forwards>
     <forward   name="main"             path="/index.jsp" />
     <forward   name="success"          path="/hello.jsp" />
     <forward   name="failure"          path="/error.jsp" />
     ...
  </global-forwards>

  <action-mappings>
     ...
    <!-- Struts action -->
    <action    path="/TestAction"
               type="com.db.moar.jsp.actions.TestAction"
               name="deptForm"
              scope="request"
           validate="false" >
    </action>

My problem occured with the "deptForm". I could not see what the problem was?
I have associated, what was supposed to be, the form bean with the
action as you can see above. It is quite correct.

In my test "delegation.jsp"  the actual "Dept" bean is created and used.
I put in a default dummy value sin form actual to prove that is loaded.

Now when I look at the code this morning I say it did not derive ActionForm!

class Dept  extends Object {
      String firstName="foo", lastName="bar";
      getFirstName() { ... }
      ...
}

I changed the code, recompiled it:

class Dept  extends org.apache.struts.actions.ActionForm {
      String firstName="foo", lastName="bar";
      getFirstName() { ... }
      ...
}

It worked as expected. Damn!
--
Peter Pilgrim          |  |        ++44 (0)207-545-9923
            .... \  \  ___   /  / ... .
            -   ----  ( * )  ---   --
_____________________________Cafe_Savannah,_San Antonio,Ibiza__



---------------------------------------- Message History ----------------------------------------


From: steven.valin@javelinsoftware.com on 25/09/2001 10:38 MST

Please respond to struts-user@jakarta.apache.org

To:   struts-user@jakarta.apache.org
cc:
Subject:  Re: JSP is not creating and/or populating an action form?


Have you ensured that your struts-config.xml is written correctly, in particular the <action name="xxxForm"> tag parameter and the associated <form-bean name="xxxForm" type="com.a.b.c...."> tag?

On Tue, 25 September 2001, "Peter Pilgrim" wrote:

>
> JSP is not creating and/or populating an action form?
>
> I can associate the <html:form> with the action form.
> I can see the bean created by the time the JSP is generated.
> However when I <html:submit> the form the action.perform()
> method has a "form" parameter that equals null.
> I look at the struts-config.xml and it looks correct to me.
> How do a find out what the bug is ?  Any tips, hints?
>
> Ta very much
> --
> Peter Pilgrim          |  |        ++44 (0)207-545-9923
>             .... \  \  ___   /  / ... .
>             -   ----  ( * )  ---   --
> _____________________________Cafe_Savannah,_San Antonio,Ibiza__



--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.