You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Art Vandalay <av...@yahoo.com> on 2003/02/13 16:28:11 UTC
Cannot Find Bean In Scope
I am working a very simple JSP page using Struts. The
page has some field labels and 1 input field. It is
this input field that is causing me problems. Whenever
I put <html:text> into my JSP page and rebuild/run my
application I get the following runtime error:
Cannot find bean org.apache.struts.taglib.html.BEAN in
any scope
There is no BEAN inside the html taglib, so I have no
idea what this message is trying to tell me.
At the point of error my application is simply trying
to display this page by forwarding to it from an
Action. I expect the input field to be empty when the
page displays. I'm not sure how my Form comes into
play, if at all, in that scenario, but I've tried
coding the following, all of which result in the
error:
<html:text name="formName" property="formProperty"/>
<html:text property="formProperty"/>
By the way, all my <bean:message...> tags work fine.
They pull the appropriate value from a resource file.
It is only the <html:xxxx> tag that causes this
problem. Any <html:xxxx> tag will fail.
I do have the following at the top of my JSP:
<%@ taglib uri="/WEB-INF/struts-bean.tld"
prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld"
prefix="html" %>
%>
>From what I understood, the name of the form is
optional -- Struts will get it from the config file.
Can anyone shed any light on this?
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Cannot Find Bean In Scope
Posted by Nicolas De Loof <ni...@cgey.com>.
You have to use the <html:form> tag : it's role is to find the formbean in
some scope or create a new one. It allows your HTML form to display values
that are stored in the formbean. Struts uses the <html:form> "action"
attribute to get the ActionMapping, and so get the formBean name and scope
(as defined in struts-config.xml).
<html:form action="something.do">
<html:text property="formProperty"/>
</html:form>
This formBean is stored into page scope for other <html:xxx> tags under
default "org.apache.struts.taglib.html.BEAN" name. Using <html:text> "name"
attribute will override this behaviour by telling <html:text> another name
to search in scope. This can be useful to build a form with values from
other beans, but this beans have to exist in scope !
Nico.
> I am working a very simple JSP page using Struts. The
> page has some field labels and 1 input field. It is
> this input field that is causing me problems. Whenever
> I put <html:text> into my JSP page and rebuild/run my
> application I get the following runtime error:
>
> Cannot find bean org.apache.struts.taglib.html.BEAN in
> any scope
>
> There is no BEAN inside the html taglib, so I have no
> idea what this message is trying to tell me.
>
> At the point of error my application is simply trying
> to display this page by forwarding to it from an
> Action. I expect the input field to be empty when the
> page displays. I'm not sure how my Form comes into
> play, if at all, in that scenario, but I've tried
> coding the following, all of which result in the
> error:
>
> <html:text name="formName" property="formProperty"/>
> <html:text property="formProperty"/>
>
> By the way, all my <bean:message...> tags work fine.
> They pull the appropriate value from a resource file.
> It is only the <html:xxxx> tag that causes this
> problem. Any <html:xxxx> tag will fail.
>
> I do have the following at the top of my JSP:
>
> <%@ taglib uri="/WEB-INF/struts-bean.tld"
> prefix="bean" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld"
> prefix="html" %>
> %>
>
> >From what I understood, the name of the form is
> optional -- Struts will get it from the config file.
>
> Can anyone shed any light on this?
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Shopping - Send Flowers for Valentine's Day
> http://shopping.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org