Jumping in late, but that's not gonna work. One possibility is to create a
"dispatch" tag that you use like:
<tag_prefix:dispatch target="${i}"/>
And if you still want to be able to use <tag_prefix:xyz/>, etc. "statically",
you'll probably want to create a delegate class that contains the real
functionality and can be used by both the dispatch and "static" tags.
BTW, is this just curiosity on your part or do you have a real use case where
this seems appropriate (like generating tag tests maybe)? If you really have a
use case, perhaps sharing that would help generate more effective feedback.
Quoting Gaurav Vaish <[EMAIL PROTECTED]>:
> No No No.
>
> It's simple to 'out' the value of a variable.
>
> What I'm looking for is to 'out' a tag-lib component itself. Say, I have
> some components that can be rendered as:
>
> <tag_prefix:xyz/>
> <tag_prefix:abc/>
> <tag_prefix:pqr/>
>
> I want 'xyz'/'abc'/'pqr' to be dynamic. If you don't understand, here's
> what I mean:
>
> ----------------------------------
> Vector v; // contains a list of components, eg: v.add(abc), v.add(xyz),
> v.add(pqr)
> // abc instanceof MyComponent1
> // pqr instanceof MyComponent2
> // xyz instanceof MyComponent3
>
> <c:forEach var="i" items="${v}">
> <tag_prefix:${i}/>
> </c:forEach>
> ----------------------------------
>
> This is a summary of what I want.
>
> I hope that makes things clearer.
>
> Or am I still unable to express myself? :(
>
>
> Cheers,
> Gaurav
>
>
> ----- Original Message -----
> From: "Martin van Dijken" <[EMAIL PROTECTED]>
> To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> Sent: Friday, March 12, 2004 20:35
> Subject: RE: Iterator : Newbie
>
>
> > Hey Gaurav,
> >
> > Whay you indicate seems as simple as:
> >
> > <c:forEach var="item"
> > items="${some-variable-set-by-request-setattribute}">
> > <c:if test="${item.selected}">
> > <c:out value="${item}"/>
> > </c:if>
> > </c:forEach>
> >
> > What you might want to do is read the Sun JSTL Specification. It provides
> an
> > excellent reference to how the tags work and is very readable. Check it
> out
> > at:
> >
> > http://java.sun.com/products/jsp/jstl/
> >
> > Grtz,
> >
> > Martin
> >
> > -----Oorspronkelijk bericht-----
> > Van: Gaurav Vaish [mailto:[EMAIL PROTECTED]
> > Verzonden: vrijdag 12 maart 2004 15:44
> > Aan: Tag Libraries Users List
> > Onderwerp: Re: Iterator : Newbie
> >
> >
> > Hi Martin,
> > Thanks...
> >
> > But probably this is not what I am looking for. Or may be I got you
> > wrong.
> >
> > Snippets will make it once-for-all includes. But the include is
> dynamic.
> > It is known only at runtime.
> >
> > So, I would like to have something like the following:
> >
> > <tag:selector var="item" items="somevar">
> > <tag:if var="$item.selected">
> > <tag:render item="$item/>
> > </tag>
> > </tag:selector>
> >
> > One way would be to use JSP-snippet:
> >
> > <%
> > for(int i = 0; i < somevar.size(); i++)
> > {
> > MyItem item = somevar.get(i);
> > if(item.isSelected())
> > {
> > item.render(whatever, parameter, list, required, like,
> > context, request, response, servlet, etc);
> > }
> > }
> > %>
> >
> > Can you provide in more details of what you meant by HTML Snippets?
> >
> >
> > Cheers,
> > Gaurav
> >
> >
> >
> > ----- Original Message -----
> > From: "Martin van Dijken" <[EMAIL PROTECTED]>
> > To: "Tag Libraries Users List" <[EMAIL PROTECTED]>
> > Sent: Friday, March 12, 2004 12:34
> > Subject: RE: Iterator : Newbie
> >
> >
> > > Hey Gaurav,
> > >
> > > Please explore a bit further.
> > >
> > > - Your components are HTML snippets?
> > > - The configuration on whether to display them, can be read how?
> > >
> > > Martin
> > >
> > > -----Oorspronkelijk bericht-----
> > > Van: Gaurav Vaish [mailto:[EMAIL PROTECTED]
> > > Verzonden: donderdag 11 maart 2004 20:31
> > > Aan: [EMAIL PROTECTED]
> > > Onderwerp: Iterator : Newbie
> > >
> > >
> > > Hi,
> > >
> > > I have just started with TagLibs - and uff! what a hot + fun time I
> > had.
> > >
> > > Coming to point... I have the following scenario:
> > >
> > > - A set of components that I want to display.
> > > - Their display (visible or not, and order) is given by a
> > configuration
> > > which is user dependent.
> > > - So, I want to use an interator.
> > >
> > > * The iterator will contain the list of components to be displayed.
> > >
> > > Problem how to tackle this. Simple, ain't? ;-)
> > >
> > > => I think having these components also as TagLib will help, or am I
> > > wrong?
> > > => But still, how do I display them?
> > > => One way is to use iframes. Separate JSP for each! But that will
> > make
> > > it really huge. And adding one component means adding one JSP also. I
> > don't
> > > like this approach.
> > >
> > > Or is there any better approach altogether? Using some advanced
> > features
> > > of JSF? (I must admit, I know, probably, only J of JSF.)
> > >
> > > btw, has anybody seen the implementation of IBuySpy on .Net? I
> really
> > > like the 'Controls' thing. You can add them as modules. Is it possible
> to
> > do
> > > it this way in Java? All the components are gathered using configuration
> > > files... and then displayed as needed.
> > >
> > >
> > > Cheers,
> > > Gaurav
--
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]