One warning I'd give is that the code below assumes that the type of
the attribute is a HashMap. That's not necessarily a safe assumption
long term as the ${pageInput.foo} expression is meant to be used as
that -- an expression.
At the very least, cast to a Map...
:)
Eddie
On 11/9/05, Yongqin Xu <[EMAIL PROTECTED]> wrote:
> Thank you for the input. Since the 3rd party tags I am using only
> takes id attribute which pull from pageContext. I will have to
> tweak a little bit as following in my jsp to get the object passed
> through:
>
> <% HashMap map =
> (HashMap)pageContext.findAttribute("pageInput");
> pageContext.setAttribute("pageViews", map.get("pageViews"));
> %>
>
> reduce one level of hash mapping. it does not look pretty, but works.
>
> -----Original Message-----
> From: Eddie O'Neil [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 09, 2005 2:11 PM
> To: Beehive Users
> Subject: Re: beehive pageInput id
>
> Yongqin--
>
> In NetUI, page inputs are passed along in an implicit object that is
> called "pageInput", so something like this:
>
> ${pageInput.pageViews}
>
> basically executes this code:
>
> pageContext.findAttribute("pageInput");
>
> rather than:
>
> pageContext.findAttribute("pageViews");
>
> The latter expects that the pageViews is directly present in a Servlet
> attribute map (page context, request, session, servlet context), but
> that's not exactly what happens. :)
>
> In the 3rd party tag you're using, can you use a runtime expression
> to reference some variable in the page? If so, you can just use the
> JSP 2.0 EL expression above to refer to the specific variable in the
> page input map:
>
> ${pageInput.pageViews}
>
> Hope that helps.
>
> Eddie
>
>
>
> On 11/9/05, Yongqin Xu <[EMAIL PROTECTED]> wrote:
> > I need to embed third party custom jsp tags inside netui tags as
> > following pattern:
> >
> >
> >
> > <netui-data:declarePageInput name="pageViews" type="MyPageViewType"/>
> >
> > <3rdpartytags id="pageViews">
> >
> > goes here....
> >
> > ....
> >
> > </3rdpartytags>
> >
> >
> >
> > In my Controller.java, I create a new object of the page input type,
> > then forward it the
> >
> > above jsp page, when I use ${pageInput.pageViews.someAttribute}, it
> will
> > output correct value
> >
> > for the attribute.
> >
> >
> >
> > But the problem is: inside the 3rd party tags where using "id" to
> > reference the page input
> >
> > variable object, it could not find the object under name "pageViews".
> > The underneath call in custom
> >
> > tag impl is pageContext.findAttribute(getId()) in the custom tag. If I
> > use <jsp:useBean id="pageViews"...>
> >
> > it will work well.
> >
> >
> >
> > So the question is how do I pass the bean object through page input
> > netui tag to 3rd party custom jsp tag
> >
> > which is looking for the object in pageContext with the string value
> of
> > "id" attribute?
> >
> >
> >
> > thanks
> >
> >
> >
>
>