jstl

struts2 iterator tag help

I am using the Struts iterator tag and trying to get 3 elements of my list in 1 iteration. This is what I have. <s:iterator status="stat" value="(secondResultSet.size()/3).{ #this}" > <s:property value="#stat.count" /> <!-- Note that "count" is 1-based, "index" is 0-based. --> <s:property value="%{secondResultSet.get(#stat.inde...

pack:tag does not work in websphere

I find the pack:tag very cool. It minifies javascripts, CSS and other stuff thereby reducing the network payload. It works quite fine on Tomcat. But when I run it on Websphere AS 6.1, it does not work. There are no errors reported in the logs, but it simply does not work. Anyone pointers/tips would be great. ...

ForEach and Facelets

Hello, My managed bean : public List<String> getLiQuickNav(){ System.out.println("I'm here..."); List<String> l = new ArrayList<String>(); l.add("toto"); l.add("tata"); l.add("titi"); return l; } My forEach : <c:forEach var="categorie" items="#{mainControleur.liQuickNav}"> <h:outputLabel value="${categorie}"/> </c:for...

Strange behaviour of ArrayList

Hello everybody. I am writing a website using JSP, JSTL, Servlets and JavaBeans. At one point of my code, I am trying to use an ArrayList of objects, and a strange thing is happening: when I add the first object it is fine, and when I add a second object it adds it in the second place, but the object at index(0) gets the same values as...

Cannot redirect with the response.sendRedirect

Hello everybody, I gooogled and googled for hours on how to make a redirect in jsp or servlets. However when i try to apply it, it doesn't work. Code that i have inside jsp page: <% String articleId = request.getParameter("article_id").toString(); if(!articleId.matches("^[0-9]+$")) { response.sendRedirect("index.js...

JSF <c:if> with different object type

Hello, I'm trying to compare two different object in JSF. A String and an Integer, of cours it don't work... //myVar ==> Integer object //myVar2 ==> String <c:if test="${myVar == myVar2}"> YES!!!!!!!! </c:if> I try with myVar.toString but it's wrong. So how to do it ? Thank's ...

JSTL tag not translate in HTML.

Hi, My imports : xmlns:c="http://java.sun.com/jstl/core" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" My JSTL Code : <h:outputLabel value="YESS" > <fmt:formatNumber value="0.25" type="percent"></fmt:formatNumber> HTML generated code: <label>YESS</label> <fmt:formatNumber value="0.25" type="percent"></fmt:formatNumbe...

prevent x:out from stripping elements within selected node

Given the following XML file: <?xml version="1.0" encoding="UTF-8"?> <doc> <head> <title>Introduction</title> <section>section</section> <channel>testing/test</channel> </head> <body> <h1>Heading</h1> <p>Lorem ipsum dolor sit amet.</p> <p>Donec sed enim.</p> </bod...

redirect from jsf ?

Hello everybody, I am working on application with jsp, jstl and jsf for my college project, thats being said, I am as well very new to jsf. Everything is going great so far. However, I seems to have a problem figuring out how to do redirect from managed bean to page with dinamyc parameters. For example article.jsp?article_id=2 Can som...

How can I post parameters for JSTL import tag (<c:import>)?

I'm currently using JSTL tag in a JSP page to import the content of an external page: <c:import url="http://some.url.com/"&gt; <c:param name="Param1" value="<%= param1 %>" /> ... <c:param name="LongParam1" value="<%= longParam1 %>" /> </c:import> Unfortunately the parameters are now getting longer. Since they are encoded as ...

How to Escape Character in EL with JSTL tag?

I have this JSP code snippet: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <c:choose> <c:when test="${var1.properties[\"Item Type\"] eq \"Animal's Part\"}"> <c:set var="cssClassName" value="animalpart" /> </c:when> <c:otherwise> <c:set var="cssClassName" value="" /> </c:otherwise> </c:choose> The JS...

c:foreach using List: Must evaluate to a Collection, Map, Array, or null

So I'm trying to loop over a List<MyClass> for display in the view of my spring webflow application. However I get the error Must evaluate to a Collection, Map, Array, or null. <c:forEach items="#{orderedStuff}" var="a"> #{a.PrettyName}test </c:forEach> I've also tried $ instead of #. Here is my xml flow definition. <view-state ...

How to select the first element of a set with JSTL?

I managed to do it with the next code but there must be an easier way. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <c:if test="${fn:length(attachments) > 0}"> <c:forEach var="attachment" items="${attachments}" varStatus="loopCount"> ...

Using JSTL within JSP Pages in Struts based web app

I have a Struts 1.2 based Web App which uses lot of scriptlet code in the JSP page, I wish to clean up the code by using JSTL.The Servlet Specification Level: 2.3 and JSP Specification Level: 1.2. I am using WSAD 5.1. I tried using <c:if></c:if> tag, but I get the following error on building the project. "JSP Translate: unable to load i...

Why does JSP/JSTL division by 1000 sometimes give remainder?

When dividing by 1000 I sometime run across a bug that doesn't do the division "correctly". For example, when dividing 90.55 by 1000 instead of getting .09055 I get .090549999999. <c:out value="${bean.paPrice / 1000}" /> Why is this happening? Is this a result of floating point math? A google search seemed to indicate that this may...

Escape apostrophe as \' with c:out JSP

I have an object field with person's last name. If I use ${person.lastName}, I get O'Brian If I use <c:out value="${person.lastName}"/> I get O'Brian Both outputs breaks the next jsp code in IE <a href="#" class="delete" onclick="if(confirm('<c:out value="${application.lastName}"/> ' + _('Are you sure you want to dele...

Resource files for language having characters other than ISO 8859

Hi, We are implementing i18n using JSTL and encountered an issue that the resource texts defined in .properties file and having non ISO 8859 characters (e.g. inidic languages) can not be rendered by tag. After diving through the code of tag and BundleHelper class ultimately we found that it internally uses ResourceBundle.getBundle met...

'#' character before EL expression used inside a JSTL tag behaves strangely

I have the following code to set a userId variable: (userId set in prior code) <c:set var="userId" value="(Cust#${userId})" /> Which produces the following string: (Cust#${userId}) The following code works as expected, however: <c:set var="userId" value="(Cust# ${userId})" /> displays the following string (Cust# 0001) . Why does...

jsessionid is occured in all urls which are generated by jstl <c:url..> tag

I've got some strange bug: when I open page first time in some browser all references has jsessionid parameter (like <a href="/articles?name=art&jsessionid=5as45df4as5df"..>). When I press F5 or refresh the page by any other ways all that stuff is disappeared and everything works fine until I close my browser (and all tabs should be clo...

In JSP, how to identify the type of Object present in a List ?

Is it possible in JSP to get the type of Object in List, just like we do in Java myDataBind.getResultsList().get(0).getClass(); or is it possible to achieve something like this: if ( myDataBind.getResultsList().get(0) instanceOf MyClass ) { doThis; } i don't prefer scriptlets, but if it is not possible to do without scriptlets th...