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
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]