You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "David M. Karr" <dm...@earthlink.net> on 2001/09/26 04:07:21 UTC

Re: populating a form bean without using a submit button

>>>>> "chiji" == chiji nwankwo <cn...@hotmail.com> writes:

    chiji> Hi,

    chiji> Is it possible to populate a form bean without using the submit button to post the form.  I am using the link tag to forward
    chiji> the user from one page to another, but at the same time I would like the contents of the form to be sent to the Action form
    chiji> class. 

    chiji> I do not know if what I am trying to do is actually possible but if it is please let me know how it can be done or at least
    chiji> where I can start looking for examples that implements this. 

    chiji> Thank you very much in advance.

I believe I have a similar problem, although it's possible I'm suffering from
architectural confusion.  I have a link on a main page, like this:

   <html:link page="/listClasses.do">List Classes</html:link>

I have a "<form-bean>" like this:

  <form-bean name="listClassesForm" type="com.intsoft.sgs.web.forms.ListClassesForm"/>

And my "<action>" is this:

  <action path="/listClasses"
			 type="com.intsoft.sgs.web.actions.ListClassesAction"
			 name="listClassesForm" scope="request">
   <forward name="success" path="/class/listClasses.jsp"/>
  </action>

An excerpt from "/class/listClasses.jsp":

    <logic:iterate name="listClassesForm"
                   property="allClasses"
                   id="klass"
                   type="com.intsoft.sgs.web.dao.ClassDAO">
     abc
    </logic:iterate>

But when I try to run the app, I get in the browser:

javax.servlet.ServletException: Cannot find bean listClassesForm in scope null
	at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)

I'm sure I have something basically wrong, but I don't see it.  You may have a
similar problem.

-- 
===================================================================
David M. Karr          ; Best Consulting
dmkarr@earthlink.net   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)


Re: populating a form bean without using a submit button

Posted by Rogerio Zamboim <ro...@cpqd.com.br>.
Hi David/Chiji, I have used this solution to my problem and works fine. Basically,
the difference is that instead of calling the jsp page in a success, I´m forwarding
the same action (listCalsses.do). Sure, I had also to control the flow (forwards) in
my action class.

If you need more example, I can send you.

Rogerio Zamboim
System Analyst - dotIP Project
CPqD - Telecom & IT Solutions - Brasil

"David M. Karr" wrote:

> >>>>> "chiji" == chiji nwankwo <cn...@hotmail.com> writes:
>
>     chiji> Hi,
>
>     chiji> Is it possible to populate a form bean without using the submit button to post the form.  I am using the link tag to forward
>     chiji> the user from one page to another, but at the same time I would like the contents of the form to be sent to the Action form
>     chiji> class.
>
>     chiji> I do not know if what I am trying to do is actually possible but if it is please let me know how it can be done or at least
>     chiji> where I can start looking for examples that implements this.
>
>     chiji> Thank you very much in advance.
>
> I believe I have a similar problem, although it's possible I'm suffering from
> architectural confusion.  I have a link on a main page, like this:
>
>    <html:link page="/listClasses.do">List Classes</html:link>
>
> I have a "<form-bean>" like this:
>
>   <form-bean name="listClassesForm" type="com.intsoft.sgs.web.forms.ListClassesForm"/>
>
> And my "<action>" is this:
>
>   <action path="/listClasses"
>                          type="com.intsoft.sgs.web.actions.ListClassesAction"
>                          name="listClassesForm" scope="request">
>    <forward name="success" path="/class/listClasses.jsp"/>
>   </action>
>
> An excerpt from "/class/listClasses.jsp":
>
>     <logic:iterate name="listClassesForm"
>                    property="allClasses"
>                    id="klass"
>                    type="com.intsoft.sgs.web.dao.ClassDAO">
>      abc
>     </logic:iterate>
>
> But when I try to run the app, I get in the browser:
>
> javax.servlet.ServletException: Cannot find bean listClassesForm in scope null
>         at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
>
> I'm sure I have something basically wrong, but I don't see it.  You may have a
> similar problem.
>
> --
> ===================================================================
> David M. Karr          ; Best Consulting
> dmkarr@earthlink.net   ; Java/Unix/XML/C++/X ; BrainBench CJ12P (#12004)