jstl

Nested expression in JSP/JSTL

Hello everyone, I am using JSPs for the view, and Spring MVC 3.0 for the controller. In my JSP, I want to show the current DateTime, for which I have the following code... <c:set var="dateTimeDisplayFormat" value='<spring:message code="display.dateFormat" />'/> <c:set var="currentDateTime" value='<%= new SimpleDate...

How to overcome caching problem of jsf?

I have 7 drop down in my jsp(Using JSF tag-Select One Menu), 2 drop downs are dependent on other 2 drop downs. The scope of my Managed Bean is session.I have a single page and my result is a graph/table depending on the drop down menu selection. But my selection is getting cached and at times on refreshing the code my bean and my jsp pag...

c:when and c:if don't work

I can access my variable stored in a backing bean from my JSF2 page, so things like <h:outputText value="#{myBean.myValue}"/> work, and the value (which is an int btw.) prints okay. However, when trying to use this value in conditional expressions within c:if and/or c:when tags it never equals anything... so: <c:if test="#{myBean.myV...

How can I retrieve all values from a Map using EL

Hello, 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 using EL (Expression language). Also how can I access the keys? Thanks for the help. Ravi. ...

How do I access ModelMap in a jsp?

How can an object be accessed from the ModelMap in jsp so that a method can be called on it? Currently I recieve this error: Syntax error on token "$", delete this token JSP <body> <% MenuWriter m = ${data.menus} %> <%= m.getMenus()%> </body> Java @Controller @RequestMapping("/dashboard.htm") @SessionAttributes(...

Limit string length in FreeMarker

Hi, I'm trying to get a substring from a string in FreeMarker. However there are 2 thigns to consider: The string can be null The string can be shorter then the maximum string length I do the following: <#list landingpage1.popularItems as row> <li> <span class="minititle"> <#assign minititle=(row.title!"")> ...

How to implement some if-then logic with JSF and Facelets?

I have a bean with field status. Depending on status value different css class should be applied to render it. So, I need something like this (very far from real things pseudocode): if status == "Approved" cssClass = "green" if status == "Rejected" cssClass = "red" <span class="cssClass">Some info</span> I tried to apply js...

JSF web page include

I am currently working on a JAVA web application using JSF, Facelets, JSTL and EL. I have 10 pages that need to include some HTML and Javascript that I have placed into a inc.jspf. I have tried to use: <jsp:include page="inc.jspf" /> but I am getting an error: The prefix "jsp" for element "jsp:include" is not bound. Is there an...

How to use JSP/JSTL to create a CSV file

Hi, I have created a jsp file, with a simple table on it. I would like to create another jsp file that users can open in Excel or save as an xls. This is my entire jsp file, this creates a csv file which opens in Excel when a link is clicked: <%@ page contentType="text/html;charset=windows-1252"%> <%@ taglib prefix="c" uri="http://jav...

Spring MVC rendered JSP truncated when containing special characters

If I pass variables with extended characters to my JSP, the end of the rendered file is truncated by 2 bytes for each non-ascii character. Why is this so? Here is an example. My Controller: import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestM...

How to dynamically set header value in JSP

I have a JSP file which creates an Excel document. I want to dynamically set the name of the file to be downloaded. This is how I set the file name to "test.xsl": <% response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition","attachment; filename=" + "test.xsl" ); %> How can I set the file nam...

Possibility to use <c:import> with spring views

I was wondering if there is a possibility that I could use the JSTL function to import spring Views. so something likes this: <div id="contentHolder"> <c:import url="/foo.do?bar" /> </div> In the XML stands: <!-- Viewresolver --> <b:bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver...

JSP/JSTL using or not using <c:out> tags

i'm helping develop a java jsp jstl based web service and all dynamic objects are being inserted using ${object.foo} and i was wondering if it made a difference whether or not it was actually in <c:out value="${object.foo} />? the pages all load correctly, but i wonder if there is something that i'm not seeing that may be an issue. ...

JSP/JSTL word wrap in a table

I have a table of width 800 and one inner table within that of width 100%. The tr td looks like this <tr><td align="right" valign= "top"><c:out value="HOUSE: " /></td><td nowrap align="left" valign= "top"> <c:out value='${houseBean.houseLabel}'/></td></tr> Now when houseLabel goes beyond 5 values, the table grows beyond its width of...

Accessing Map elements via Enum key in Freemarker

Hi all, I'm trying to access elements in a HashMap. The keys of this HashMap are defined by an Enum. After going through the documentation, I figured that in order to be able to access the Enum, I have to send it to Freemarker like so: BeansWrapper wrapper = BeansWrapper.getDefaultInstance(); TemplateHashModel enumModels = wrapper.get...

JSTL c:if inside a JSF h:dataTable

I'm trying to put an outputLink inside a dataTable when the state is finished. <h:dataTable value="#{bean.items}" var="item" width="80%" > <h:column> <f:facet name="header"> <h:outputText value="State" /> </f:facet> <c:if test="#{item.state!= 'Finish'}"> <h:out...

is there an elegant way to inject a spring managed bean into a java custom/simple tag

I have a bunch of java custom tags that use spring managed beans.. since i cant find a way to inject into a custom tag, i created a helper class that provides static methods to "getTheObjectINeedBean()" for all the spring bean objects i need.. I do not like this approach at all. i really want to be able to inject a spring managed bean ...

Unable to read TLD "META-INF/c.tld"

Hi everyone... there's this issue with JSTL I'm stuck with for the past couple of days. Any help is appreciated. Tomcat: 6.0.28 Eclipse: Helios pom.xml : <dependency> <groupId>javax.servlet</groupId> <artifactId>jstl</artifactId> <version>1.1.2</version> </dependency> <dependency> <groupId>javax.servlet</groupId> ...

JSTL fmt library throws 500 error, requires sessions enabled?

I'm developing a simple servlet/JSP, data-driven web site on Google App Engine. I've started to use the JSTL fmt library on some of my data entry forms and get the following session-related error when using tags <fmt:dateFormat> and <fmt:numberFormat>: [java] java.lang.RuntimeException: Session support is not enabled in appengine-web.xm...

How do I perform bitwise logic within JSTL if statements?

I have a need to perform a bitwise test within a JSP but can't for the life of me figure out how to do it with EL. I want to do something like: <c:if test="${(test & testFor) == testFor}"> <h3>Test Passed</h3> </c:if> Of course I can do it with ordinary JSP syntax: <% if ((test & testFor) == testFor) { %> <h3>Test Passed</h3> <%...