el

JSP EL expressions not working in tag files

We are trying to move our Java web application from a Tomcat 5.5 server to a more modern Tomcat 6.0.24 one, but we are having some problems with JSP EL. The expressions placed within XML tag files are not recognized by the server, that simply renders them as text (just as in the following example). Any ideas why? <object id="${id}" ...

Expression language implicit objects

How can the JSF implicit objects be access via expression language? For example, if I wanted to determine what roles the current principal is associated with, how could I do this? ...

Is there and shorthand for <fmt:message key="key" />

It's tedious and ugly to write things like: <input type="button" value="<fmt:message key="submitKey" />" /> And in case you want to nest the message tag in another tag's attribute it becomes even worse. Is there any shorthand for that. For example (like in JSF): <h:commandButton value="#{msg.shareKey}" /> (spring-mvc-only solution...

JSP EL String concatenation

How do I concatenate strings in EL? I want to do something like this but it doesn't work: ${var1 == 0 ? 'hi' : 'hello ' + var2} It throws an exception trying to cast 'hello' to a Double ...

Jsp Expression Language Problem

I have a jsp in which there is something like this ${pageContext.request.parameterMap.instanceNo[0]} I want to iterate through each of its value. I tried the below code but doesn't work <s:iterator id="test" var="" value="${pageContext.request.parameterMap.instanceNo[0]}"> Hello </s:iterator> ...

Concatenating in JSP/EL through a loop

So im trying to do something that might not be possible. I want to iterate through something like this: i is set as an iterator <c:forEach begin="1" end="${total}" var="i"> <td>${prod${i}.name}</td> </c:forEach> This Obviously doesnt work, but I think it portrays what im trying to do. I want to concatenate a variable to another ...

How does Java expression language resolve attributes? (in JSF 1.2)

So we all know that #{someBean.value} will try and get the content of some property on 'someBean' called 'value'. It will look for getValue(). However, what if this property is boolean? It will look for isValue(). What it won't look for is hasValue(). This got me thinking, what exactly does it do? this: http://download.oracle.com/docs/...

Passing EL expressions or managed bean instance in jsp:include

I have a generic buttons jsp: <wow:button id="addButton" iconClass="add16 icon16x16" action="#{managedbean.addNew}" type="submit" immediate="true" value="#{lblMsg.label_add }" /> <wow:button id="deleteButton" iconClass="iconCancel" action="#{managedbean.delete}" type="submit" value="#{lbl...

which scope (application, servletContext, httpSession) will EL use for interpreting attributes

Hi all, when I use <c:out value="${track}"> in a jsp, where should the attribute track be located in (servletContext, httpSession and request)? I tried to have a controller to set the attribute track to the httpSession, but then ${track} doesn't give me anything in the .jsp. On the other hand, if I set it to the servletContext, ${track}...

Trying to do an OR test with JSTL inside my jsp template

Hi, i have the following code from my JSP which doesn't quite work: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <c:set var="contextPath" value="${pageContext.request.contextPath}" /> <c:set var="requestURI" value="${pageContext.request.requestUR...

How to pass a string containing double quotes from a jsp to a servlet through URL using get method

Hi all, I want to set a jsp parameter to an attribute value which may contain special symbols, then use a form GET submit to pass the parameter to a servlet controller. For example, the parameter is: <input type="hidden" name="searchTerms" value="${sessionScope.combTerms}"></input> I noticed if sessionScope.combTerms contains double qu...

JSF2 EL: Access ResourceBundle keys which contain dots from within Javascript?

My JSF2 application is fully internationalized, using a ResourceBundle. Now i have a lot of Javascript-code, which does some alerts and stuff. There i would like to access my ResourceBundle. I could successfully access simple ResourceBundle keys like this: alert("#{bundle.message_email_sent}"); Unfortunately, my convention for keys ...

How to get the value of an arbitrary bean property from a JSP?

I'm trying to write a custom JSPX tag that reads the value of a given bean property from each object in a given list, with the name of that property passed to the tag as a JSP attribute. The tag would look something like this: <jsp:root xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:jsp="http://java.sun.com/JSP/Page" ...

Performance of resolving EL Value Expressions

I have a JSF2 application that renders a large table with complex content. Unfortunately, each request takes up to 6 seconds to process. Using simple debug output inside a phase listener, I could see that the performance loss distributes evenly over all phases that process the component tree. So I started up a profiler to see what's goin...

When should you use textual "or, and, not" over symbolic "||, &&, !" logical operators in JSP EL?

The textual versions may improve readability for non-programmers, but otherwise I can't imagine any differentiators. ...

How to set precision for EL division on JSF

How can I set precision for such EL result? <h:outputText value="#{businessPlanPreviewBean.plan.a1 != 0 ? businessPlanPreviewBean.plan.a2/businessPlanPreviewBean.plan.a3 : 0 } " > </h:outputText> I tried <f:convertNumber maxFractionDigits="2" /> but no luck... <f:convertNumber pattern="#,##" /> - the same thing Mojarra JSF implem...

Unterminated C:out Tag on Ternary Operator

Hi, I have set a session scope object in my session and I want to add a disabled attribute in one of my button using JSTL Ternary operator. The getPermission is a map of privileges for the currently login user but I am not sure why I am encountering the error unterminated c:out tag in my JSP when it goes to this JSP. <button type="but...

Retrieving the first element of a TreeMap using JSTL/EL/JAVA

I am trying to access the first element of a TreeMap, I have the following HTML in a JSP file: <c:forEach items="${subscriber.depent}" var="entry" begin="0" end="0" step="1"> <c:set var="dep" value="${entry.value}" /> </c:forEach> This code gets me the first element of the TreeMap but this just seems like a 'hack' to me. I have a...

JSP EL and scope attribute confusion

Hello everyone, I would like to ask you some help in clarifying a few issues. But, before anything, some code is inbound first - it's a really simple login example I've constructed. Container is Tomcat 5.5.27. Let's assume correct username and pass combination is entered; questions are at the bottom. LoginPage.jsp (entrypoint - view)...

Expression Language & Eclipse warning: "items" does not support runtime expressions

i have the following JSP: <%@ page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ page isELIgnored="false"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <meta http-equiv="Content-Ty...