struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jerome Jacobsen" <jerome.jacob...@gentootech.com>
Subject RE: cannot find bean error
Date Sun, 22 Dec 2002 14:51:00 GMT
Hi Tobias,

What you are doing looks OK to me.  You are correct in that you do NOT need
to do the following in your action:
> I added this line:
>     request.setAttribute("mitarbeiterAuswahlForm",mitarbeiterAuswahlForm);

The bean is already stored in the session by the framework before your
action is called.

Without seeing the rest of your JSP it is difficult to tell why you are
getting the error.  Try adding the following near the beggining of your JSP:

<jsp:useBean id = "mitarbeiterAuswahlForm"
	class="de.adesso.aproda.forms.MitarbeiterAuswahlForm"
	scope="session"/>

If that got rid of the problem then you may have been accessing the bean in
the JSP via other standard JSP tags.

-Jerome


> -----Original Message-----
> From: Tobias Flohre [mailto:flohre@adesso.de]
> Sent: Sunday, December 22, 2002 9:09 AM
> To: struts-user@jakarta.apache.org
> Subject: cannot find bean error
>
>
> Hello everybody,
>
> I have a serious problem, I already looked up all the list but didn't get
> any information helping me to solve it. I am new to struts, so maybe it is
> a simple thing, please take a look!
>
> I have an action mitarbeiterAuswahlShow filling a form bean
> MitarbeiterAuswahlForm, here the parts of the struts-config.xml:
>
>     <form-bean      name="mitarbeiterAuswahlForm"
>                     type="de.adesso.aproda.forms.MitarbeiterAuswahlForm"/>
>
>     <action    path="/mitarbeiterauswahlShow"
>
> type="de.adesso.aproda.actions.MitarbeiterauswahlShowAction"
>                name="mitarbeiterAuswahlForm"
>                scope="session"
>                parameter="method">
>       <forward name="show"
> path="/mitarbeiterauswahl.jsp"/>
>     </action>
>
> When the action is called, the code is processed (i have some
> system.out.println in the action class, it looks good there). The server
> tells me this:
>
> 2002-12-22 02:37:13 - path="" :action:  Storing instance under attribute
> 'mitarbeiterAuswahlForm' in scope 'session'
>
> which sounds pretty good to me, too.
> But when I want to access mitarbeiterauswahlForm in the jsp, I get this:
>
> javax.servlet.ServletException: Cannot find bean mitarbeiterAuswahlForm in
> scope session
>
> What are possible reasons for this??
>
>
> For further information I add some snippets from the action class and the
> jsp:
>
>     MitarbeiterAuswahlForm mitarbeiterAuswahlForm
> = (MitarbeiterAuswahlForm)form;
> ...
>     mitarbeiterAuswahlForm.setMitarbeiter (mitarbeiter);
>     mitarbeiterAuswahlForm.setStudenten (studenten);
>     return mapping.findForward("show");
>
> I added this line:
>     request.setAttribute("mitarbeiterAuswahlForm",mitarbeiterAuswahlForm);
> in the action class, but it is not necessary to do this by myself, right?
> struts should put in the scope, no?
>
> and the jsp:
> <bean:define id="mitarbeiterListe" name="mitarbeiterAuswahlForm" property
> ="mitarbeiter"/>
> <html:select styleClass="textbox" size="1" tabindex="3" property
> ="mitarbeiterID">
> <html:options collection="mitarbeiterListe" property="id" labelProperty
> ="name" />
> </html:select>
>
>
>
> Thanks for any help!!!
>
> Tobias
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>




--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message