Ternary operator in JSTL/EL

I tested the following page in Tomcat 5.59, JSP 2.0 and JSTL 1.1. It ran without any errors. <%@taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%> <c:set var=”value” scope=”request” value=”someValue”/> <c:out default=”None” escapeXml=”true” value=”${not empty value ? value : ‘None’}” /> <c:out default=”None” escapeXml=”true” value=”${empty value ? ‘None’ : value}” /> <c:set var=”value” scope=”request” value=”” /> <br/> <c:out default=”None” escapeXml=”true” … Read more

How to compare two object variables in EL expression language?

In Expression Language you can just use the == or eq operator to compare object values. Behind the scenes they will actually use the Object#equals(). This way is done so, because until with the current EL 2.1 version you cannot invoke methods with other signatures than standard getter (and setter) methods (in the upcoming EL … Read more

Tomcat 7 and JSTL

I have been fighting with this for several hours. Here is a complete solution. I am using Tomcat 7, which is a Servlet 3.0-compliant server. If you desire to use the Servlet 3.0 spec, you must have your web.xml as follows: <web-app xmlns=”http://java.sun.com/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd” version=”3.0″> If you’re using Maven, your pom.xml should have … Read more

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

Remove the standard.jar. It’s apparently of old JSTL 1.0 version when the TLD URIs were without the /jsp path. With JSTL 1.2 as available here you don’t need a standard.jar at all. Just the jstl-1.2.jar in /WEB-INF/lib is sufficient. See also: How to install JSTL? The absolute uri: http://java.sun.com/jstl/core cannot be resolved Our JSTL wiki … Read more

Get value from hashmap based on key to JSTL

if all you’re trying to do is get the value of a single entry in a map, there’s no need to loop over any collection at all. simplifying gautum’s response slightly, you can get the value of a named map entry as follows: <c:out value=”${map[‘key’]}”/> where ‘map’ is the collection and ‘key’ is the string … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)