> -----Original Message----- > From: A mailing list about Java Server Pages specification > > I started experimenting with JSTL but very quickly run into issues > using the c:if tags. > The code snippet shows my current code. the problem is with > the first c:if. > This does not evaluate to print the image found string. the > second however > works as expected appending the the ?nnr=somevalue to the URL. > > Does anyone see what mistake I am making ? > > <% String s = "images" ; %> > <%=s%> > <c:if test= "${s == 'images'}" > > image found > </c:if> > <c:if test= "${param.nnr == 'hello'}" > > hello found > </c:if>
Your first mistake was not curling up with the JSTL specification when you started getting into this. If you had, you would have known that the JSTL expression language only reads "scoped variables", and not scriptlet variables. Scoped variables are the ones available in any of the four "scopes" (HashMaps, internally) of "page", "request", "session", or "application". Your second case works because it's referencing a variable from the request scope. =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant archives, FAQs and Forums on JSPs can be found at: http://java.sun.com/products/jsp http://archives.java.sun.com/jsp-interest.html http://forums.java.sun.com http://www.jspinsider.com