You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by John Moore <jo...@jmsd.co.uk> on 2005/04/23 13:59:20 UTC
Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
I know this is one of those errors to which there is an apparent
standard answer - namely, that I must be using one of the html input
tags outside the context of an enclosing htm:form tag. The thing is,
though, I'm not. What I have is basically this:
<html:form action="/admin/customer/edit.do">
<div id="editPage">
<tiles:insert attribute="pageBody"/>
</div>
</html:form>
This is used by a page like this:
<%@ taglib prefix="sn" tagdir="/WEB-INF/tags/sn" %>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %>
<%@ taglib prefix="tiles" uri="/WEB-INF/tld/struts-tiles.tld" %>
<%@ taglib prefix="bean" uri="/WEB-INF/tld/struts-bean.tld" %>
<tiles:insert page="/WEB-INF/jsp/admin/editPage.jsp">
<tiles:put name="pageBody" type="string">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<sn:viewTextFieldRow property="id" size="5"/>
<sn:textFieldRow label="shop.fabric.name" property="name"
size="40"/>
<sn:textFieldRow label="shop.fabric.code" property="code"
size="10"/>
<sn:textAreaRow label="shop.fabric.description"
property="description" rows="6"/>
<sn:viewTextFieldRow property="createdDate" size="10"/>
<sn:viewTextFieldRow property="modifiedDate" size="10"/>
</table>
<sn:editButtonBar/>
</tiles:put>
</tiles:insert>
The sn tags contain the html:text, etc., which is obviously where the
error is being triggered.
So, given that all the content is being evaluated within the body of the
html:form tag, why would the html input tags not be able to find the bean?
John
--
==============================================
John Moore - Norwich, UK - john@jmsd.co.uk
==============================================
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Posted by John Moore <jo...@jmsd.co.uk>.
I should also point out that if I treat the whole page as a JSP 2.0 tag
(which I'm currently doing, until I resolve the JSP/Struts issue), it
works. That is, if instead of having:
<html:form action="/admin/customer/post.do">
<div id="editPage">
<tiles:insert attribute="pageBody" beanScope="request"/>
</div>
</html:form>
I have:
<html:form action="/admin/customer/post.do">
<div id="editPage">
<jsp:doBody/>
</div>
</html:form>
Then the html:input tags contained within the body (provided by
jsp:doBody) are perfectly able to find the form bean of the parent
html:form, unlike in the JSP version. I can't determine what the
difference might be, unless it is to do with scope.
John
--
==============================================
John Moore - Norwich, UK - john@jmsd.co.uk
==============================================
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Posted by John Moore <jo...@jmsd.co.uk>.
Robert Taylor wrote:
> John, does the action to which the url /admin/customer/edit.do
> correspond have a form associated with it?
> You might also try removing the ".do" from the url as struts should
> automatically add this for you. For example:
> <html:form action="/admin/customer/edit">
> <div id="editPage">
> <tiles:insert attribute="pageBody"/>
> </div>
> </html:form>
>
Yes, it does have a form associated with it.
I should point out that the issue must be to do with the nesting of the
Tiles, because if I don't use a Tile and just do the following, it works
fine:
<html:form action="/admin/customer/edit.do">
<div id="editPage">
<table width="100%" border="0" cellpadding="4" cellspacing="0">
<sn:viewTextFieldRow property="id" size="5"/>
<sn:textFieldRow label="shop.fabric.name" property="name"
size="40"/>
<sn:textFieldRow label="shop.fabric.code" property="code"
size="10"/>
<sn:textAreaRow label="shop.fabric.description"
property="description" rows="6"/>
<sn:viewTextFieldRow property="createdDate" size="10"/>
<sn:viewTextFieldRow property="modifiedDate" size="10"/>
</table>
<sn:editButtonBar/>
</div>
</html:form>
So, somehow when used in a Tile enclosed within the html:form tag
(instead of directly as above), the various html: tags lose awareness of
the form bean. Adding a 'scope="request"' to the html:form does not
solve the problem.
John
--
==============================================
John Moore - Norwich, UK - john@jmsd.co.uk
==============================================
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Posted by Robert Taylor <64...@bellsouth.net>.
John, does the action to which the url /admin/customer/edit.do
correspond have a form associated with it?
You might also try removing the ".do" from the url as struts should
automatically add this for you. For example:
<html:form action="/admin/customer/edit">
<div id="editPage">
<tiles:insert attribute="pageBody"/>
</div>
</html:form>
/robert
John Moore wrote:
> I know this is one of those errors to which there is an apparent
> standard answer - namely, that I must be using one of the html input
> tags outside the context of an enclosing htm:form tag. The thing is,
> though, I'm not. What I have is basically this:
>
> <html:form action="/admin/customer/edit.do">
> <div id="editPage">
> <tiles:insert attribute="pageBody"/>
> </div>
> </html:form>
>
>
> This is used by a page like this:
>
> <%@ taglib prefix="sn" tagdir="/WEB-INF/tags/sn" %>
> <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %>
> <%@ taglib prefix="tiles" uri="/WEB-INF/tld/struts-tiles.tld" %>
> <%@ taglib prefix="bean" uri="/WEB-INF/tld/struts-bean.tld" %>
>
> <tiles:insert page="/WEB-INF/jsp/admin/editPage.jsp">
> <tiles:put name="pageBody" type="string">
> <table width="100%" border="0" cellpadding="4" cellspacing="0">
> <sn:viewTextFieldRow property="id" size="5"/>
> <sn:textFieldRow label="shop.fabric.name" property="name"
> size="40"/>
> <sn:textFieldRow label="shop.fabric.code" property="code"
> size="10"/>
> <sn:textAreaRow label="shop.fabric.description"
> property="description" rows="6"/>
> <sn:viewTextFieldRow property="createdDate" size="10"/>
> <sn:viewTextFieldRow property="modifiedDate" size="10"/>
> </table>
> <sn:editButtonBar/>
> </tiles:put>
> </tiles:insert>
>
> The sn tags contain the html:text, etc., which is obviously where the
> error is being triggered.
>
> So, given that all the content is being evaluated within the body of the
> html:form tag, why would the html input tags not be able to find the bean?
>
> John
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org