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 Patrick Burleson <ta...@patrickburleson.com> on 2003/12/30 17:27:48 UTC
Using Sets with JSTL
Hello all,
First off, is there an archive of this mailing list that can be searched?
Now, my question: How can you work with Sets in JSTL? It appears most of
the other Collections API objects are supported, but not Sets. The
reason I ask is I have a page that gets a List of data that I want to
iterate over (very easy with JSTL's forEach), but I want to check a Set
to see if it contains the current element so I can do something a little
bit different. To get this working, I had to switch to using Java code
in the JSP. It seems like this would be a common problem to solve. And I
don't think I should have to write some sort of wrapper class to achieve
this with a base Collections API class as that seems more clumsy than
having Java code in the JSP.
Thanks,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Using Sets with JSTL
Posted by Patrick Burleson <ta...@patrickburleson.com>.
Kris Schneider wrote:
>One possibility: http://marc.theaimsgroup.com/?l=taglibs-user
>
>
>
Thanks
>I'm not sure why it's not included, or if it was even considered, but here's a
>guess. While Collection, and hence List and Set, supports "contains", Map does
>not. Instead, Map supports "containsKey" and "containsValue". So, what would you
>provide for tags?
>
But don't Maps support the [$key] notion of looking up values?? Why not
something similar for Sets?
>This may be a case where developing your own taglib would be
>appropriate. Or, maybe what you're doing is better suited to a servlet or
>component of an MVC/Model 2 framework. In other words, do more data processing
>before forwarding to the JSP.
>
>
>
I had not considered this. But I could do that with my current MVC. I
could just pass a list of the values as they should be displayed.
Thanks,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
Re: Using Sets with JSTL
Posted by Kris Schneider <kr...@dotech.com>.
Quoting Patrick Burleson <ta...@patrickburleson.com>:
> Hello all,
> First off, is there an archive of this mailing list that can be searched?
One possibility: http://marc.theaimsgroup.com/?l=taglibs-user
> Now, my question: How can you work with Sets in JSTL? It appears most of
> the other Collections API objects are supported, but not Sets. The
> reason I ask is I have a page that gets a List of data that I want to
> iterate over (very easy with JSTL's forEach), but I want to check a Set
> to see if it contains the current element so I can do something a little
> bit different. To get this working, I had to switch to using Java code
> in the JSP. It seems like this would be a common problem to solve. And I
> don't think I should have to write some sort of wrapper class to achieve
> this with a base Collections API class as that seems more clumsy than
> having Java code in the JSP.
I'm not sure why it's not included, or if it was even considered, but here's a
guess. While Collection, and hence List and Set, supports "contains", Map does
not. Instead, Map supports "containsKey" and "containsValue". So, what would you
provide for tags? This may be a case where developing your own taglib would be
appropriate. Or, maybe what you're doing is better suited to a servlet or
component of an MVC/Model 2 framework. In other words, do more data processing
before forwarding to the JSP.
> Thanks,
> Patrick
--
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