el 1 « JSTL « JSP-Servlet Q&A





1. Access Enum value using EL with JSTL    stackoverflow.com

I have an Enum called Status defined as such:

public enum Status { 

    VALID("valid"), OLD("old");

    private final String val;

    Status(String val) {
 ...

2. Method calls in EL    stackoverflow.com

When I write Java webapps, I usually use JSTL tags. I think that these tags are great, except for one thing that pisses me off: while the expression language allow you ...

3. I met problem trying to use EL in JSTL tags    stackoverflow.com

I'm trying to use expression language inside jstl tags but strange error occurs. "According to TLD or attribute directive in tag file, attribute value doesn't accept any expressions" The code is something like ...

4. Whats the difference between "${foo.bar}" and "#{foo.bar}"?    stackoverflow.com

I can use objects from my Java Beans within .jsp files by using the Expression Language (EL). Therefore I can get my value by typing ${foo.bar}. But I can also use ...

5. How do I round a number in JSTL?    stackoverflow.com

I'm doing a division in a JSP and I'd like to round the result - how should I do this? i.e.

<c:set
  var="expiry"
  value="${(expire.time - now.time) / (60 * 1000)}"/>
...how ...

6. Can I access the values of an enum class from a JSP using EL?    stackoverflow.com

I have an enum class USState. I would like to iterate through the states in a JSP. Is it possible to access a list of USStates without first setting such a ...

7. How to get a random number in JSTL?    stackoverflow.com

I would like to get something like the next code generated in JSTL

<c:choose>
    <c:when test="${random number is even}">
        <div class="redlogo">
  ...

8. What java view technology is this?    stackoverflow.com

It seems velocity and freemarker look fairly similiar, at least for basic usage. Anyhow, what is the "built in" or standard view framework called? It looks like:

<c:if test="${someobject.property != null}">

9. Item value in JSTL foreach loop not working in Portlet    stackoverflow.com

Given the following Portlet Code:

ArrayList nameList = new ArrayList();
nameList.add("Willi Willisch");
nameList.add("Seppi Seppisch");

renderRequest.setAttribute("names", nameList);
And the following JSP Code:
<c:forEach var="aName" items="${names}">
    <tr>
       <td>${aName} </td>
  ...





10. JSTL Session Lookup - Key Has Periods    stackoverflow.com

I am working with some legacy code, and at some point there is a key in the session that is something like

session.setAttribute("com.org.something.Object",someObject);
Now trying to access this in a jsp using ...

11. Evaluate empty or null JSTL c tags    stackoverflow.com

How can I validate if a String is null or empty using the c tags of JSTL? I have a variable of name var1 and I can display it, but I want ...

12. Assigning outcome of another JSTL tag as value of one JSTL tag    stackoverflow.com

I've got this, which is working:

<c:choose>
    <c:when test="${sometest}">
        Hello, world!
    </c:when>
    <c:otherwise>
    ...

13. JSTL number handling    stackoverflow.com

I set the session variable like below

getSession(true).setAttribute("entriesCount", "10");
then the call below returning nothing in jstl.
<c:out value="${#session.entriesCount}"/>

14. JSTL vs Old School JSP EL Conflict?    stackoverflow.com

I have been developing a web application for about six months with no framework or JSTL support. After recent decisions, I have decided that I am interested in integrating JSTL use ...

15. Is there a shorthand for ?    stackoverflow.com

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 ...

16. Trying to do an OR test with JSTL inside my jsp template    stackoverflow.com

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.requestURI}" />
<c:set var="isPeople" value="${fn:contains(requestURI, '/People/')}" />
<c:set var="isJobs" ...





17. How can I retrieve all values from a Map using EL    stackoverflow.com

I have a SortedMap which I'm populating in my service classes, I want to display all the values stored in the map in a sorted order. How can I do that ...

18. Unterminated C:out Tag on Ternary Operator    stackoverflow.com

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 ...

19. Retrieving the first element of a TreeMap using JSTL/EL/JAVA    stackoverflow.com

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}" ...

20. Access the size of a collection in JSP/JSTL/EL    stackoverflow.com

I have a List variable called services in my JSP page. I need to add some markup to the page if there's more than 1 element in the list. What I'd ...

21. What is JSP 2 version of ?    stackoverflow.com

How can I set a value using JSP 2? I mean, if ${val} is the new version of <c:out value="${val}" />, what is the JSP 2 version of <c:set var="val" value="bla" />? ...

22. Ternary Operator in JSP EL fails    stackoverflow.com

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"}/>  ...

23. Can implicit object application be used with EL in JSP 2.0?    stackoverflow.com

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 ...

24. how to get an object and invoke a method in jstl EL in a JSP    stackoverflow.com

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 ...

25. Accessing constants in JSP using EL    stackoverflow.com

Possible Duplicates:
accessing constants in JSP (without scriptlet)
Reference interface constant from EL
Hi,
I am having a class which contains all the constants ...

26. javax.el.PropertyNotFoundException: using JSTL in JSP    stackoverflow.com

I have a JSP where I'm trying to use JSTL tags to display data from an in-memory instance of a class. The data consists of a series of Strings where each ...

27. Difference between LENGTH[...] and fn:length(...) in JSP EL    stackoverflow.com

What is the difference between the LENGTH[...] and the JSTL function fn:length(...)? I tried to search to difference but I did not see any example that uses the first one. Here is an ...

28. Websphere 7 & JSTL: Cannot get value from arrays -> Missing Resource in EL implementation: ???propertyNotReadable?    stackoverflow.com

Since upgrading from WAS6.1 to WAS7.0 I'm getting an error when trying to display a value contained in an array. Java:

private Date[] days = new Date[10];
public Date[] getDays() {
    ...

29. Getting equal symbol expected while using jstl    stackoverflow.com

I am getting

org.apache.jasper.JasperException: /WEB-INF/AllClientBatchDetails.jsp(54,103) equal symbol expected
And here is the jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*%>   
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>   
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" ...

30. PropertyNotFoundException in EL    stackoverflow.com

Can some one help me with the exception I have. in servlet i send list of countries to jsp

request.setAttribute("countries", allCountryList);
and in jsp i want to display them in dropdown list , ...

31. concepts about JSTL    stackoverflow.com

I want to understrand what happens when i use JSTL to access maps,in Hidden features of JSP/Servlet in @blausC's answer, he explained what happend, but when i try to use the ...

32. What does this condition do?    stackoverflow.com

<c:if test="${not empty userList)}">
    <table cellpadding="5">
        <tr class="even">
            <th>Name</th>
  ...

33. In JSP EL enum value always empty    stackoverflow.com

When trying to get an EL condition working I found that enum values are completely ignored. This seems to me contrary to the spec.

<c:out value='${com.foobar.data.BookingStatus.FAILED}' />
<c:out value='${BookingStatus.FAILED}' />
<c:out value='${com.foobar.data.BookingStatus.failed}' />
<c:out value='${BookingStatus.failed}' ...

34. What is the difference between rt and el versions of the JSTL?    stackoverflow.com

What is the difference between RT and EL versions of the JSTL? That is, when coding a JSP in a JSP 2.0 or later environment, what are the important functional differences? Are ...

35. Correct syntax for this JSTL:     stackoverflow.com

I have an if statement that I am trying to perform with JSTL. My code is below (the variables values is an ArrayList that contains a user defined object and type is ...

36. Avoid whitespace in JSTL c:set statement    stackoverflow.com

I have a JSP file that generates a list of LIs, where the first and the last item in the list get a special class assigned to them. I currently use ...

37. Alternative for fn:startsWith(var,'value') - jsp    stackoverflow.com

I have the this piece of code on my application:

<c:when test="${fn:startsWith(var,'value')}">
    <c:set var="other_var" value="x"></c:set>
</c:when>
But I just find out that I am not allowed to use any version above ...

38. How can i access a HashMap with JSTL-EL in a jsp?    stackoverflow.com

Hi all I have a problem with accessing an HashMap into my jsl using EL and JSTL my hashmap is like so in the servlet:

HashMap indexes=new HashMap();
then lets suppose i add somthing like:
indexes.put(1,"Erik")
then ...

39. Is it possible to detect java class type using El with JSTL?    stackoverflow.com

code is like this:

 <c:forEach  items="${itemList}" var="item">
 //do stuff based on the class type of item               ...

40. How can I use a dynamic collection name in a JSP loop?    stackoverflow.com

HI, I need to be able to do something like this (of course this doesn't work:

  <c:forEach var="column" items="${model.${listName}.enabledColumns}">
    ${column.name}
  </c:forEach>
Thanks

41. How would you get a returned value from a JSTL tag back into an EL statement?    stackoverflow.com

Basically I have a custom tag that handles querying a java object for me.

<c:set var="profit">
    <ct:get-profit transaction="${transaction}"/>
</c:set>
Now the problem is that I want to use that value ...

42. Using Complex Collection with c:foreach in JSP    stackoverflow.com

If I have this code in a .java file

for (int i = 0; i < person.getFamilyMembers().get(0).getCount(); i++) {
    out.println(person.getFamilyMembers().get(0).getMember().get(i).getLastName()
        + "<br ...

43. JSTL or JSP 2.0 EL for getter with argument    stackoverflow.com

How can I access a getter that has a parameter using JSTL or JSP 2.0 EL? I want to access something like this:

public FieldInfo getFieldInfo(String fieldName) {
 ....
}
I could access this in ...

44. Is there an implementation of JSTL core tags that can be used outside J2EE?    stackoverflow.com

I am trying to find a way to use JSTL core tags outside a JSP page. My goal is to be able to externalise a mapping file written in JSTL and ...

45. Nesting EL functions    stackoverflow.com

I am getting EL parsing exceptions when doing this in my JSP:

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@page import="my.InternalConstants"%>

[...]

<c:set var="MYPREFIX"><%=InternalConstants.MYPREFIX%></c:set>

[...]

<c:forEach var="name" items="${data.names}" varStatus="status">
    <c:set ...

46. How can I check whether session was timed out?    stackoverflow.com

How can I check in an error page whether the session was timed out? I have tried

<c:choose>
    <c:when test="${empty pageContext.request.session}">
        //do smth
 ...

47. JSTL conditinal check    stackoverflow.com

On my current page I am using JSTL to check if data is available for my form. Problem I am facing is "if there is no data I am not seeing ...

48. JSTL c:choose issue    stackoverflow.com

I need to implement a switch case using JSTL choose statement, I have tree different choise. Anyone knows the reason why the code below doesn't work? Thanks in advance.

<c:choose>
    <c:when ...

49. In JSTL/JSP when do I have to use and when can I just say ${myVar}    stackoverflow.com

I've been doing this the whole time in my JSP code:

<c:out value="${myVar}"/>
Today I just realized for the first time that I seem to be able to use this shorter version just ...

50. Use JSTL forEach loop's varStatus as an ID    stackoverflow.com

I want to use the count from the JSTL forEach loop, but my code doesnt seem to work.

<c:forEach items="${loopableObject}" var="theObject" varStatus="theCount">
    <div id="divIDNo${theCount}">
    </div>
</c:forEach>
produces
<div ...

51. using ServletContext and ServletConfig in scriptlets and EL    stackoverflow.com

I tried to run the following lines.

<%=application.getInitParameter("tagline")%>               
<br />
<%=config.getInitParameter("admincontact")%>

${initParam.tagline}
<br />
${pageContext.servletConfig.initParameter("admincontact")}
And my web.xml is
<servlet>
<jsp-file>/index.jsp</jsp-file>
<init-param>
    <param-name>admincontact</param-name>
 ...

52. How do you get the first element in a collection in JSTL/EL?    stackoverflow.com

My container contains multiple widgets. I'm looping over them and the widgetcode variable is set with the value of the last widget in the loop. But what I really want is the first ...

53. How to test against values in request.getHeader using jsp?    stackoverflow.com

Im setting up a variable:

<% String userAgent = request.getHeader("user-agent");%>
How do I test different scenarios against userAgent using
<c:choose></c:choose>
Im not sure how to set it up?

54. c:out JSTL tag doesn't work for me    stackoverflow.com

I've just recently been trying to get into JSTL and I'm experiencing some problems with it.. This is a tag in my hello.JSP:

<p>Greetings, it is now <c:out value="${now}"/></p>
And it's supposed to ...

55. How to display all values of an enum as     stackoverflow.com

I need to display all values of an enum as <option> elements. I have achieved this using scriptlets:

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="errors" ...

56. checking equality of value from property file in JSP    stackoverflow.com

I am using property file for customizing messages, mean while I am setting priority in the property file, can I test the equality of priority in JSP using <c:if> tag. for ...

57. How to escape double quotes in JSTL function?    stackoverflow.com

I need to change " to \" with JSTL replace function to use the string in input tag like:

<input type="hidden" name="text" size="40" value="${text}">
If the ${text} has the ", the ...

58. how to display data in JSTL for list containing objetcs?    stackoverflow.com

In request attribute I have list of objects (say user objects) so how can I loop through it display data on my jsp page? Can I use <c:foreach> but then how ...

59. How to code this if structure in JSTL?    stackoverflow.com

can we code the following if condition inside the <c:if test="${}> ?

if((myFlag == true) && (flag1 != null || flag2 != null || flag3 != null))

60. How to test against enum values in JSTL EL test?    stackoverflow.com

I have the following block in my JSP, which converts from ENUM values {CREATE, CREATE_FROM_CAMPAIGN, OPEN} into nice, readable status texts. For some reason the first test against 'CREATE' works, but the ...

61. JSTL chaining of functions    stackoverflow.com

I get a value calling X.getY().getZ(); Why is <c:set var="XYZ" value="${X.y.z}"/> not working ? Is there something I can do ? I , of course , have divided this to 2 set ...

62. Java EL object `${pools}`    stackoverflow.com

I'm trying to adapt the code used in PSI Probe (or more generally, the idea of PSI Probe) to be used inside of my company's web application. I can ...

63. Fun with JSTL looping and int conversion into a char    stackoverflow.com

What I need is a jsp using jstl that will output column labels as Chars (A, B, C...) instead of ints (1, 2, 3...) and just for fun, when the int ...

64. Manipulate calendar year in HTML    stackoverflow.com

Instead of hardcoding the years in my dropdownlist, I'm going to pass over a year as the first option value and then want the following 2 values to be the previous ...

65. JSP,EL property not found    stackoverflow.com

I am creating a simple guest book in JSP in order to learn this technology. Currently I have two classes: guestbook/GuestBook.class and guestbook/Entry.class (I haven't finished the app yet, so I ...

66. [Code] About Jstl's EL    coderanch.com

67. Using JSTL EL in my own custom tags    coderanch.com

Has anyone else ever tried to incorporate JSTL-EL support in their own custom tags. I (mostly) love the simpler, XML-friendly EL syntax and would really like to use it in my own custom tags, so they can work nicely with JSTL. Some documents I have found seem to imply that you can do this, but I haven't yet found out exactly ...

68. About JSTL, EL and size Collections    coderanch.com

69. JSTL EL (JSP 2.0)    coderanch.com

Hi I'm reading Beginning JSP 2.0 from Wrox Press and I'm stuck. I can't get the new Expression Language to work. I've got J2SE 1.4, Tomcat 5 Beta on Windows 2000. JAVA_HOME, CATALINA_HOME, CLASSPATH and PATH set as per the book. Sometimes the EL just shows up as literal text eg: ${something} in the HTML output. Sometimes I get the following ...

71. about JSTL and EL usage    coderanch.com

72. EL with JSTL    coderanch.com

hmm, weird. I've done something similar quite often but don't use the var attribute. works fine, I use it to create the elements of a

73. Map to Dropdown with JSTL & EL    coderanch.com

74. JSTL EL language not resolving    coderanch.com

75. JSTL: EL is not working    coderanch.com

76. Why JSTL core tag doesn't support EL?    coderanch.com

I downloaded JSTL 1.1.2 from Apache, which I believe is the latest version and I still got this problem, I can evaluate EL using core_rt, but not core. while according to the official documentation, I should use core for EL but not core_rt, can anyone help? [ July 15, 2005: Message edited by: Ren Shao ]

77. Regarding EL and JSTL    coderanch.com

78. Doubt regarding EL and JSTL    coderanch.com

79. JSTL(EL) Problem    coderanch.com

80. dequoting jstl/el results    coderanch.com

81. JSTL & EL    coderanch.com

82. Jstl and EL    coderanch.com

84. Not able to run EL with JSTL using RAD    coderanch.com

85. JSTL and EL    coderanch.com

86. JSTL c:forEach tag and EL    coderanch.com

87. How to set up JSTL and EL?    coderanch.com

88. JSTL and EL    coderanch.com

89. JSTL/EL c:if inside of c:forEach    coderanch.com

90. For JSTL + EL experts    coderanch.com

/usr/userMainPage.jsp(37,63) equal symbol expected at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88) at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:194) at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:144) at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1339) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1578) at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1807) at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1070) at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1378) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1578) at org.apache.jasper.compiler.Parser.parse(Parser.java:127) at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:212) at org.apache.jasper.compiler.ParserController.parse(ParserController.java:101) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:156) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:296) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:277) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:265) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:299) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:315) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at com.pix.filters.HibernateTransactionFilter.doFilter(HibernateTransactionFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at ...

92. JSTL EL (JSP 2.0)    coderanch.com

Hi I'm reading Beginning JSP 2.0 from Wrox Press and I'm stuck. I can't get the new Expression Language to work. I've got J2SE 1.4, Tomcat 5 Beta on Windows 2000. JAVA_HOME, CATALINA_HOME, CLASSPATH and PATH set as per the book. Sometimes the EL just shows up as literal text eg: ${something} in the HTML output. Sometimes I get the following ...

93. scriptlets Vs EL/JSTL    coderanch.com

94. Help in JSTL And EL    coderanch.com

Originally posted by Khaled abdo: Hello i am new at EL and JSTL can anyone help me how to Access this attribute This is JSP if(request.getAttribute("UPDATE_PASSWORD") != null && request.getAttribute("UPDATE_PASSWORD").equals(true)) { this is the JAVA static bean and the code is public static final String UPDATE_PASSWORD ="UPDATE_PASSWORD"; and this is the setAttribute : request.setAttribute("UPDATE_PASSWORD",true); please am new in programming help me ...

96. jstl-el problem    coderanch.com

99. JSTL and EL    coderanch.com

100. Efficacy of EL & JSTL?    coderanch.com