Re: JSP and hashmap's containsKey
Lew wrote:
Try this (untested here):
<c:if test='${ ! empty myMap["keyValue"]}' >
<c:out value='${myMap["keyValue"]}' />
</c:if>
--
Lew
Please do not quote sigs.
lord.zol...@gmail.com wrote:
I'm supporting an older app which currently does not use any JSTL. How
much trouble is it to include JSTL? Would new libraries need to be
added for deployment? That would involve getting approval for new
dependencies... ugh... this was supposed to be a very small piece of
maintenance work.
It is.
I was wondering if it was possible to do this in plain old struts [sic]. =
If
not I will just write a custom tag (they are already accepted in this
app).
JSTL is just a pair of JARs, IIRC. EL uses just one, I think. They
can go in the app server (e.g., Tomcat); they don't necessarily go in
the application. If your app server doesn't support JSTL and EL, it's
too old anyway.
If you don't have them, you don't need to write a custom tag. It's
better to load the desired result as a request attribute in the
controller part of your MVC architecture anyway, and Struts has
conditional tags that will work in lieu of <c:if>. If you can't get
at EL, you can use <jsp:useBean>.
But really, there's no good reason not to have JSTL and EL available.
They were released five and a half years ago already, in J2EE 1.4/JSP
2.0.
<http://en.wikipedia.org/wiki/Java_EE_version_history>
<http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html>
<http://java.sun.com/j2ee/1.4/docs/tutorial/doc/
JSPIntro7.html#wp71019>
<http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSTL.html#wp74644>
--
Lew