You need to use the TEI (tag extra info) mechanism and in your TLD do like
bean:define does:

            <teiclass>org.apache.struts.taglib.bean.DefineTei</teiclass>

And then look at the DefineTei class for more insight.

Geary's Advanced JavaServer Pages book has lots of great information with
this kind of stuff.

    Erik

----- Original Message -----
From: "Wittwer Markus" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 30, 2001 4:35 AM
Subject: How does bean:define work?


> Hi!
>
> The bean:define tag simply exposes a bean as a scripting variable by
adding
> it to the page context:
>
> // from DefineTag.java
> pageContext.setAttribute(id, value, inScope);
>
> Now one can access the bean by
> <bean:define id="title" value="test"/>
> Value of title: <%= title %>
>
> I did the same within a custom tag I wrote but I cannot directly access
the
> bean as a scripting variable:
> <x:mytag id="title" key="test"> // the tag retrieves some key and stores
it
> in the bean "title"
>
> Value of title: <%= title %>
> causes an "Variable title not defined" exception,
>
> but
>
> Value of title: <%= pageContext.findAttribute("title").toString() %>
> works fine.
>
> Before anyone asks: I have to use scriptlets, because I want to nest the
> output within another struts tag.
>
>
> Thanks for your help,
>
> Markus Wittwer
>

Reply via email to