el

Custom tag not evaluating expressions; c and fmt tags are evaluating expressions

I have a .jsp page that begins with <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <%@ taglib uri="/WEB-INF/mytags.tld" prefix="mytags" %> With the header of mytags.tld having the following content: <taglib> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> Expressions are supported by the core tags, so ...

Get domain name in url with JSTL?

I am trying to get the domain name from the url with JSTL. The 2 methods I know return the wrong info. I need exactly what is in the url. When I do: ${pageContext.request.remoteHost} I get an IP. When I do ${pageContext.request.serverName} I normally get the right domain name but on a server we have on amazon it is returning "server1" ...

JSTL & Spring: Accessing methods in conditionals

I have an object with a method public boolean hasPermission(String role) { return permissions.contains(role); } I want to do the equivalent of: <c:if test="${row.hasPermission(role)}"> <td></td> </c:if> But I cannot access the hasPermission method from within the JSP file. How can I do it? ...

Ternary Operator in JSP EL fails

Is nesting of EL Expressions in Ternary Operator allowed? What is wrong with the following expression? <input class="text_field" type="text" name="receivedBy" id="receivedBy" style="width:250px;" maxlength="64" value="${empty obj.val ? obj1.attr1.val ' ' obj2.attr1.val: obj3.val"}/> ...

How to use the JSTL "if" tag without getting "..attribute test does not accept any expressions"

Hi, I've been googling around for quite some time now and I've decided to ask this here, how would I make the following code work? <c:if test="${null != searchResults}" > <c:forEach items="${searchResults}" var="result" varStatus="status"> I've tried many different variations of this, such as: <c:if test="${search...

Can implicit object application be used with EL in JSP 2.0?

is it possible to use the implicit object 'Application' using EL in JSP 2.0? For example, instead of <%=application.getInitParameter("appkey")%> I want an EL version. I know I can use JSTL initParam but wondering if there is a way with Application.. thanks. ...

how to get an object an invoke a method in jstl EL in a JSP

I'm trying to convert the following scriptlet code to EL. I tried the following (below), but can't get it working. getValue() is a method off of ConfigFactory that returns a string: In a listener, I set the configFactory as event.getServletContext().setAttribute("ConfigFactory", new ConfigFactory()); In my scriptlet code there is: (an...

custom EL function that takes no parameters - possible?

I created an EL function that takes no parameters: <function> <name>noArg</name> <function-class>com.example.customtag.function.PrintHi</function-class> <function-signature>java.lang.String noArg()</function-signature> </function> I invoke it as follows in a jsp: <c:set var="myvar2" value="${ mytags:noArg() }"/> <c:out value="...

How to check a boolean condition in EL?

Is this correct? <c:if test="${theBooleanVariable == false}">It's false!</c:if> Or could I do this? <c:if test="${!theBooleanVariable}">It's false!</c:if> ...

Jsp and ?: not working as expected

I have this code: <c:forEach var="product" items="${products}" begin="${begin}" end="${end}" varStatus="loopStatus" step="1"> <div class="home_app "${loopStatus.index % 2 == 0 ? '' : 'white_bg'}"> When I browse to the jsp I am getting this in the div: <div }="" white_bg="" :="" ?="" 0="" 2="=" %="" ${loopstatus.index="" class="ho...

Passing a Enum value as a parameter from JSF

I am trying to migrate my existing code to using Enum and I run into some problems due to my lack experience with Enum. First of all here is my structures. In my EJB, alongs with Entity, I have a enum class (not sure if it even a class). public enum Type { PROFILE_COMMENT, GROUP_COMMENT } At my managed bean myBean.java, I hav...

Why is a dynamic created JSF EL value expression not resolved?

Hi, I got a simple setup (and a big issue): a JSP page with en empty panel grid item container and a binding to a bean. <h:panelGrid binding="#{ bean.container }" id="container" /> When the getter of the bean will be called, the container is filled with a random number of columns with a command link inside. So far so good. The contai...

How to test EL expressions correctness statically?

Hello, On our web-application, we did some refactoring on the Java beans, and due to this refactoring, some actions / getters are not available anymore. For example, in the following example: public class MyBean implements Serializable { // Old name // public String getFoo() { return "foo"; } // New name public String...

Java keywords not allowed as EL identifiers

Recently I upgraded my development tomcat from 7.0.0 to 7.0.4. I had things like: <c:set var="static" value=".." /> <c:set var="class" value=".." /> Both worked on 7.0.0 but stopped working on 7.0.4. I opened a bug, it was closed, with the answer that: In and of itself, that tag will compile. The checks for Java identifiers w...

EL enum string processing

I have a variable being passed to my JSP view from a spring controller that maps to an enum. It is being printed out at 'ENUM_VALUE', not very user friendly. What is the best way to convert this to a more readable form like 'Enum value'. I'd rather a pure EL solution so as to avoid writting more code in the controller to parse this, bu...

Accessing constants in JSP using EL

Possible Duplicates: accessing constants in JSP (without scriptlet) Reference interface constant from EL Hi, I am having a class which contains all the constants used in my application. Eg: public class AppConstants { public static final String USER_TYPE_ADMIN = "Administrator"; } Now in one of my jsp page, i need t...

JSP Access to Javabean Properties

I have a Java class with a method, hasMoreParameters(). In JSP, I want to get the property: ${holder.moreParameters} How do I do this? ...

Invoking methods using expression language

Hi! In my spring's config I need invoke method "get" (java.lang.ThreadLocal's instance object). How I can do it without creating new class with "correct" method's naming (smt like "getValue" instead of "get")? Thanks. ...

How can i do a multiselect in jsp/jstl with selected value?

Hello I have an User with some Roles User.class public class User { private Long id; private String firstName; private String lastName; private Set<Role> roles = new HashSet<Role>(0); public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return this.firstName; } pu...