You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Martin Cooper <ma...@tumbleweed.com> on 2001/03/01 01:14:26 UTC

Re: Problem using form tags across template pages

OK, now I see what's happening. The <html:form> tag sets the form bean as a
page attribute, so when your nested page (the one brought in using the
template tags) is processed, the form bean is not available, since it is in
a different page context. Hence the <html:text> tag, which needs access to
the form bean, fails.

One way to fix this would be to have the <html:form> tag store the bean as a
request attribute instead of a page attribute. However, I'm not sure if that
would break something else. I don't think so, but I'm not certain. That's a
question for Craig, I think.

--
Martin Cooper
Tumbleweed Communications

----- Original Message -----
From: "Incze Lajos" <in...@mail.matav.hu>
To: "Martin Cooper" <ma...@tumbleweed.com>
Sent: Wednesday, February 28, 2001 2:25 PM
Subject: Re: PROPOSAL: Template Screens


> On Wed, Feb 28, 2001 at 01:54:16PM -0800, Martin Cooper wrote:
> > What exception are you getting? Also, which build of Struts are you
using?
> >
> > I don't see any code that checks for being contained in a form (but that
may
> > be part of the problem!), except in the <template:put> tag, so some more
> > information on what's happening would definitely help.
> >
> > Thanks,
> >
> > Martin.
> >
>
> I did not check the code but in a formar letter i've read this
> diagnosis (I cite it all):
>
> -------------------------------------------------------------------------
> Date: Wed, 31 Jan 2001 16:04:41 -0800
> From: "Craig R. McClanahan" <Cr...@eng.sun.com>
> To: struts-user@jakarta.apache.org
> Subject: Re: Help Please: Resource not found
>
> TMalvos@gcre.com wrote:
>
> > When trying to call a JSP I receive the following message from Tomcat:
> >
> > javax.servlet.ServletException: Cannot find bean under name
> > org.apache.struts.taglib.html.BEAN
> >            at
>
>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextIm
pl.java:459)
> >
> > I checked the STRUTS distribution and did not find it.  Has anyone
> > encountered this before?  Thanks.
>
> You would get this error if you tried to use one of the input field tags
like
> +<html:text>
> -------------------------------------------------------------------------
>
> I experianced the same exception and I felt so, that probably the
> jsp got by the template does not feel itself inside an html:form.
> There was no code check as I found very quicly the above reference.
>                                                            incze



Re: Problem using form tags across template pages

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Martin Cooper wrote:

> OK, now I see what's happening. The <html:form> tag sets the form bean as a
> page attribute, so when your nested page (the one brought in using the
> template tags) is processed, the form bean is not available, since it is in
> a different page context. Hence the <html:text> tag, which needs access to
> the form bean, fails.
>
> One way to fix this would be to have the <html:form> tag store the bean as a
> request attribute instead of a page attribute. However, I'm not sure if that
> would break something else. I don't think so, but I'm not certain. That's a
> question for Craig, I think.
>

Hmm, that would also deal with a question someone else had earlier, where they
wanted to put the <html:form> tag into a "main" JSP page, and the fields in a
<jsp:include>.  I will look at it in more detail.

>
> --
> Martin Cooper
> Tumbleweed Communications
>

Craig