jstl

JSTL: check if property doesn't exist

I'm getting blocked on a jsp page and our 1 java engineer isn't able to help now. There is a template called "module-review.jsp" that is loaded in 2 instances, via a normal page load an via an api that returns it as part of a json object. There is a variable called "review.updatedDate". On a normal page view, this variable is loaded a...

JSTL sets ad Lists - checking if item exists in a set

Hello, I have a Java Set in my session and a variable also in the session. I need to be able to tell if that variable exists in the set. I want to use the contains ( Object ) method that Java has for Lists and Sets to test whether that object exists in the set. Is that possible to do in JSTL? If so, how? :) Thanks, Alex ...

<c:import> tag

Hi, I'm trying to import file from the Header.jsp in my file by using import tag url attribute, but I'm getting runtime error--java.io.FileNotFoundException: http://localhost:8081/latest/header.jsp The imported file and the importing file in the same web app(latest). The code of the importing file is: <%@ taglib prefix="c" uri="http:...

How to compare substring of a bean property in JSTL 1.0?

I have the following code in a jsp page (Struts backed): <c:if test="${USERINFO.someproperty == 'test'}"> ... </c:if> But what I would like to do is compare only a substring of someproperty, like e.g. if the suffix ends with "st". I am using JSTL 1.0 so the endsWith() function from JSTL 1.1 is not available (as far as I know) and furt...

JSTL and Javascript

Is having tags inside a jstl tag considered bad form? So for example I know the following will work but is it considered bad form to have the script tags inside my jstl tags in my jsp ? <c:choose> <c:when test="${!empty bean.value}"> <p>Its not empty</p> </c:when> <c:otherwise> **<script> callJSSomeFunction(); ...

What is the simplest way to display httpServletResponse.sendError(403, "My Message") status from JSTL

I have a servlet which does some error checking and if something is wrong I will typically do this: response.sendError(403, "My message") return; I don't want to throw an exception from the servlet - because I would like to conform with HTTP status codes. In the web.xml I have configured the following: <error-page> <er...

JSP DataBase Result Display Problem

I have a JSP MySQL query <sql:query var="libraries" dataSource="jdbc/ArabiTagOnline"><br> SELECT l.LibraryId, v1.LAvalue AS "dbESTid", v2.LAValue AS "LibName", v3.LAValue AS "Desc" FROM ((Library l LEFT JOIN LibAttrValue v1 ON l.LibraryId = v1.LibraryId AND v1.AttributeId = 1) LEFT JOIN LibAttrValue v2 ON l.LibraryId = ...

html:text tag not working

I have a form that looks somewhat like this: public class MaintainForecastInputForm extends ActionForm { private MainMenuForm mainMenuForm = new MainMenuForm(); public SelectProdLineAssociationForm selectProdLineAssociationForm = new SelectProdLineAssociationForm(); private EconometricDataForm econometricDataForm = new Econome...

Struts Tags vs. JSTL

Struts has a number of helpful custom JSP tags, and Struts-EL adds much needed EL support. I'm looking for thoughts on relative merits of using Struts/Strut-EL tags where available vs. just using JSTL tags. ...

JSTL for each problem

Hi all, I have a for each loop that it works fine when the items property is filled using an scriplet in the following way: <% List<LandingCategory> cats = beanFactory.getLandingCategories(); %> <c:forEach var="cat" items="<%=cats%>"> <c:out value="${cat.id}"/> </c:forEach> However, when trying to filled the items list w...

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

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 #{foo.bar}. Can anybody explain the difference or provide a link with meaningful information? ...

JSF tag not found

Hi, I use JSF-facelets.jar 1.1.14 (I downloaded it here) and tomcat 6.0 Manifest-Version: 1.0 Ant-Version: Apache Ant 1.7.0 Created-By: 1.5.0_12-b04 (Sun Microsystems Inc.) Implementation-Version: 1.1.14 If I understand well, JSF-facelets.jar = JSF + JSTL + Facelets (???) My problem is when I use "fmt" fonction. This code... <h...

GSP taglib import

I'm trying to use GSP outside grails and ran to my first problem. I cannot seem to do a taglib import in my GSPs. Given <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> When I run my app, I am getting a javax.servlet.ServletException: Creation of template failed: groovy.lang.GroovyRuntimeException: Failed to p...

Saving a PNG file on a server in a Java bean, using JSTL

I am writing an update page in JSTL where the user inputs some numbers. I then call a java bean - passing the numbers as parameters - which, using JFreeChart, creates a PNG image. All of this works fine when I save the file directly on my hard drive using ImageIO.write(myBufferedImage, "png", new File("C:/testChart.png")); I can al...

Handling unparseable strings in a JSP date formatter

I'm writing a JSP that sometimes needs to format a Java Date that comes out of the request. I'm doing it like this: <fmt:formatDate value="${attribute.value}" pattern="yyyy-MM-dd HH:mm:ss"/> and it works beautifully on Java Dates. However, there are times that the request attribute field with the exact same name (attribute.value) is ...

JSTL foreach and intellisense

With a code like this: <c:forEach items="${customers}" var="customer"> ${customer.name} </c:forEach> IntelliJ Idea is able to infer that the type of the "customer" variable in the ForEach loop is of the class "Customer" (given that Customers is something like List<Customer>). If I refactor the java customer class and change getNam...

How to do this using java expression language

Let just say i have the following java object that I wish to read in my jsp using el: class A { Map map = new HashMap(); int count; String getAttribute(String attrName) { return map.get(attrName); } String getCount() { return count; } } I can call count ...

How to display a date as ISO8601 with JSTL?

something like? <fmt:formatDate value='${event.starttime}' type='both'/> ...

using JSTL to build tables

I'm using this JSTL code to generate an HTML table. Every other row is given a different class so we can give the table stripes. I know we can do this easily with CSS3 but I have to support old browsers. Anyway this is the code I use - it seems very heavy - is there an easier way to do it? <c:set var="oddEven" value="true" /> <c:forEac...

JSP and JSTL using c:import

Is there a c tag equivalent of the <%@ include %> tag? Basically, when using the c:import tag, I find that the included pages cannot use c tags unless I import the jstl/core file on the included page. Thanks in advance. ...