You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Gaurav Vaish <gv...@mastergaurav.net> on 2004/03/11 20:30:46 UTC

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

Re: how to use c-rt? (or, when to mod web.xml?)

Posted by Roy Benjamin <Be...@adobe.com>.
This is the answer.  My book: "JSTL JSP Standard Tag Library
                               (Kick Start)"
has it wrong....  THANKS!  I was becoming even more confused
than usual.

Roy

On Thu, 2004-03-11 at 12:38, Kris Schneider wrote:
> Try:
> 
> <%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %>
> 
> Quoting Roy Benjamin <Be...@adobe.com>:
> 
> > I'm using:
> > 
> > 	Java SDK 1.4.2_03, 
> > 	Java J2EE 1.4
> > 	jakarta-taglibs-standard-1.0.5
> > 	jakarta-tomcat-4.1.30
> > 
> > I've had no trouble using the core, sql, and fmt tags in my JSPs.
> > ***All I did was to drop jstl.jar and standard.jar into my WEB-INF
> > directory and add the proper directives to the JSPs***
> > 
> > for example:
> >    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
> >    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
> >    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
> > 
> > I do/did not need to add anything at all the app's web.xml.
> > 
> > I'm working on a quite large and controlled application, so the
> > fewer changes I make the better.  Its very cool that I could
> > use tags just by adding the jars to the lib dir....
> > 
> > The problem:
> > 
> > Now, I have occasion to want to use c-rt as well. (Especially
> > because its too burdensome to pass data back and forth between
> > the tags and java kingdoms thru the page context for simple
> > string manipulations..)
> > 
> > As soon as I try to use c-rt, problems begin..
> > I cannot just add:
> >    <%@ taglib uri="http://java.sun.com/jstl/core-rt" prefix="c-rt" %>
> > because the uri is not found on page compile.  If I add a direct
> > reference for this URI to my web.xml, then this URI is Ok.  i.e.
> > 
> >   <taglib>
> >     <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
> >     <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
> >   </taglib>
> > 
> > fixes the c-rt issue, but now --none-- of the sql tag impls can be
> > found... even if I add another direct reference for them to the
> > web.xml, for example, adding:
> > 
> >   <taglib>
> >     <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
> >     <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
> >   </taglib>
> > 
> > to the web.xml does not help.
> > 
> > For now I give up using c-rt, but...
> > 
> > Seems very strange, any ideas?  Does this seem a familiar problem?


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: how to use c-rt? (or, when to mod web.xml?)

Posted by Kris Schneider <kr...@dotech.com>.
Try:

<%@ taglib prefix="c_rt" uri="http://java.sun.com/jstl/core_rt" %>

Quoting Roy Benjamin <Be...@adobe.com>:

> I'm using:
> 
> 	Java SDK 1.4.2_03, 
> 	Java J2EE 1.4
> 	jakarta-taglibs-standard-1.0.5
> 	jakarta-tomcat-4.1.30
> 
> I've had no trouble using the core, sql, and fmt tags in my JSPs.
> ***All I did was to drop jstl.jar and standard.jar into my WEB-INF
> directory and add the proper directives to the JSPs***
> 
> for example:
>    <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
>    <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
>    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
> 
> I do/did not need to add anything at all the app's web.xml.
> 
> I'm working on a quite large and controlled application, so the
> fewer changes I make the better.  Its very cool that I could
> use tags just by adding the jars to the lib dir....
> 
> The problem:
> 
> Now, I have occasion to want to use c-rt as well. (Especially
> because its too burdensome to pass data back and forth between
> the tags and java kingdoms thru the page context for simple
> string manipulations..)
> 
> As soon as I try to use c-rt, problems begin..
> I cannot just add:
>    <%@ taglib uri="http://java.sun.com/jstl/core-rt" prefix="c-rt" %>
> because the uri is not found on page compile.  If I add a direct
> reference for this URI to my web.xml, then this URI is Ok.  i.e.
> 
>   <taglib>
>     <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
>     <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
>   </taglib>
> 
> fixes the c-rt issue, but now --none-- of the sql tag impls can be
> found... even if I add another direct reference for them to the
> web.xml, for example, adding:
> 
>   <taglib>
>     <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
>     <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
>   </taglib>
> 
> to the web.xml does not help.
> 
> For now I give up using c-rt, but...
> 
> Seems very strange, any ideas?  Does this seem a familiar problem?

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


how to use c-rt? (or, when to mod web.xml?)

Posted by Roy Benjamin <Be...@adobe.com>.
I'm using:

	Java SDK 1.4.2_03, 
	Java J2EE 1.4
	jakarta-taglibs-standard-1.0.5
	jakarta-tomcat-4.1.30

I've had no trouble using the core, sql, and fmt tags in my JSPs.
***All I did was to drop jstl.jar and standard.jar into my WEB-INF
directory and add the proper directives to the JSPs***

for example:
   <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
   <%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
   <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>

I do/did not need to add anything at all the app's web.xml.

I'm working on a quite large and controlled application, so the
fewer changes I make the better.  Its very cool that I could
use tags just by adding the jars to the lib dir....

The problem:

Now, I have occasion to want to use c-rt as well. (Especially
because its too burdensome to pass data back and forth between
the tags and java kingdoms thru the page context for simple
string manipulations..)

As soon as I try to use c-rt, problems begin..
I cannot just add:
   <%@ taglib uri="http://java.sun.com/jstl/core-rt" prefix="c-rt" %>
because the uri is not found on page compile.  If I add a direct
reference for this URI to my web.xml, then this URI is Ok.  i.e.

  <taglib>
    <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
    <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
  </taglib>

fixes the c-rt issue, but now --none-- of the sql tag impls can be
found... even if I add another direct reference for them to the
web.xml, for example, adding:

  <taglib>
    <taglib-uri>http://java.sun.com/jstl/sql</taglib-uri>
    <taglib-location>/WEB-INF/lib/standard.jar</taglib-location>
  </taglib>

to the web.xml does not help.

For now I give up using c-rt, but...

Seems very strange, any ideas?  Does this seem a familiar problem?









---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Iterator : Newbie

Posted by Gaurav Vaish <gv...@mastergaurav.net>.
Hi Chris,

    Thanks for your response. That's great idea.

    Here's what I want to have, in real-life implementation.

    I am creating an application that will serve as a intergrated place for
most of my things, may be yours as well.

    The items that will be in this integrated-place will be implemented as
tag-lib objects. At least, I plan to do so as of now - but I may get some
good suggestions from the world.

    Now, I - as the user of the application - would like to customize the
look-n-feel as per my wish. I may like some items to showup, while not show
the ones that I may don't need frequently (compromise for
load/dispatch-time).

    Thank's for the idea. I think that should do what I want to.


Cheers,
Gaurav



----- Original Message ----- 
From: "Kris Schneider" <kr...@dotech.com>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
Sent: Saturday, March 13, 2004 00:11
Subject: Re: Iterator : Newbie


> 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 <gv...@mastergaurav.net>:
>
> > 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" <su...@windgazer.nl>
> > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > 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:gvaish@mastergaurav.net]
> > > 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" <su...@windgazer.nl>
> > > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > > 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:gvaish@mastergaurav.net]
> > > > Verzonden: donderdag 11 maart 2004 20:31
> > > > Aan: taglibs-user@jakarta.apache.org
> > > > 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 <ma...@dotech.com>
> D.O.Tech       <http://www.dotech.com/>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Iterator : Newbie

Posted by Kris Schneider <kr...@dotech.com>.
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 <gv...@mastergaurav.net>:

> 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" <su...@windgazer.nl>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> 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:gvaish@mastergaurav.net]
> > 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" <su...@windgazer.nl>
> > To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> > 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:gvaish@mastergaurav.net]
> > > Verzonden: donderdag 11 maart 2004 20:31
> > > Aan: taglibs-user@jakarta.apache.org
> > > 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 <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Iterator : Newbie

Posted by Gaurav Vaish <gv...@mastergaurav.net>.
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" <su...@windgazer.nl>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
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:gvaish@mastergaurav.net]
> 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" <su...@windgazer.nl>
> To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
> 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:gvaish@mastergaurav.net]
> > Verzonden: donderdag 11 maart 2004 20:31
> > Aan: taglibs-user@jakarta.apache.org
> > 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: taglibs-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: Iterator : Newbie

Posted by Martin van Dijken <su...@windgazer.nl>.
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:gvaish@mastergaurav.net]
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" <su...@windgazer.nl>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
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:gvaish@mastergaurav.net]
> Verzonden: donderdag 11 maart 2004 20:31
> Aan: taglibs-user@jakarta.apache.org
> 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: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: Iterator : Newbie

Posted by Gaurav Vaish <gv...@mastergaurav.net>.
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" <su...@windgazer.nl>
To: "Tag Libraries Users List" <ta...@jakarta.apache.org>
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:gvaish@mastergaurav.net]
> Verzonden: donderdag 11 maart 2004 20:31
> Aan: taglibs-user@jakarta.apache.org
> 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: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


RE: Iterator : Newbie

Posted by Martin van Dijken <su...@windgazer.nl>.
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:gvaish@mastergaurav.net]
Verzonden: donderdag 11 maart 2004 20:31
Aan: taglibs-user@jakarta.apache.org
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: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org