jstl

Access the size of a collection in JSP/JSTL/EL

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 like to do is... <c:if test="${services.size() gt 1}"> <!-- markup... --> </c:if> But you can't invoke methods on Java objects in EL (I think this is perhaps the 364823782 time I've regr...

JSTL x:out not working with x:parse

I seem to be unable to use x:out to traverse parsed XML. I'm looking for ideas on what to check to get this working. When I take out the x:out the page renders without error so I am assuming x:parse is working fine. I also use x:transform in this same JSP and it works fine...so it SEEMS like the library setup is correct. <c:catch var...

JSTL <c:forEach items="${......" what are the type restrictions

I need to use a set to not allow duplicate values. I need to list them out using the JSTL <c:forEach items="${mySet}" var="set"> //Code work done here </c:forEach> Usually I use the standard array or List here but what are the type restrictions if I want to use a HashSet? ...

jstl forToken with Nested HashMap in request Attribute

I have a HashMap (hshFields) of HashMaps (ecd_date, owned_by, etc..) with keys (label, size, etc..that I access as such: <c:out value="${hshFields.ecd_date.label}" /> <c:out value="${hshFields.owned_by.label}" /> <c:out value="${hshFields.fnd_source.label}" /> (note: I must use JSTL and not EL) the about spits out the a "label" of th...

Problem with model, view and controller

I do a hello world very easy, now I want to catch data of a class and I can't do it, when I compile the project all perfect and when I run the project show me a error: Estado HTTP 404, and I don´t know how to fix the problem, help please. my controller is welcomeController public ModelAndView handleRequest(HttpServletRequest request, H...

Accessing a JSP tag's attribute in JSTL

Hello, How do I access a JSP tag's attribute value within a JSTL tag? In the code below, I would like to access the url attribute and test if it's empty. I am using the JSTL 1.0 specification. <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ attribute name="url" required="false"%> <c:if test="${!empty url}"> ... ...

how to find size of the feeds at JSTL

Hello I need to find the size of the JSTL and write it to end="size of the feed " at the following code. Could you please help me how to find the size of the feed? Regards Altaico <x:forEach begin="0" end="4" var="story" select="$doc/rss/channel/item" varStatus="status"> //end = "size of the rss" ...

character encoding issue on website

I have some turkish characters at my website but I am not able to sme characters very well.There is a problem with nonenglish characters. I encoded it with UTF-8 and added some meta tags to fix this issue but the problem still seems same. Could you please look at the website (you can look at the code by using firebug) and tell me where ...

How do I round a positive and negative decimal in JSTL?

I have two numbers that I need to round to 4 decimal places in JSTL. One is positive: 40.7615811 40.7616 and the other is negative: -73.9940841 -73.9941 Both need to be rounded to 4 decimal places, as on the second line of each example. Is there a clean way to do this in JSTL or do I need to do this in a controller class or JSP s...

String Concatenation in EL

I would like to concatenate a string within a ternary operator in EL(Expression Language). Suppose there is a variable named value. If it's empty, I want to use some default text. Otherwise, I need to append it with some static text. ${(empty value)? "none" : value + " enabled"} This will not compile however. What would be a correct ...

Why does JSTL return false positives in null-check of image blob data?

Both of the following JSTL checks return positive - resulting in the inner message being displayed ("image not null"/"image not empty") - even when the current record does not have an image associated with it. <c:if test="${rec.imgdata != null}">image not null</c:if> <c:if test="${not empty rec.imgdata}">image not empty</c:if> The im...

Don't understand JspTagException: "Illegal use of <when>-style tag without <choose> as its direct parent

I've been staring at the tag nesting below for about an hour now and I still can't figure out why I keep getting a JspTagException: "Illegal use of <when>-style tag without <choose> as its direct parent" Are you not allowed to nest condition tags this deeply in JSTL? <c:choose> <c:when test="${rec.image1Available}"> <img alt=...

JSP mechanism for nav bar template/module

I have a navigation bar and, for some pages, a sub-navigation bar as well. I'd like to make this a module so I can easily import the navigation bars on each page. Easy enough to simply put the code in a JSP file and call: <%@include file="/WEB-INF/jsp/includes/sub_nav_bar.jsp"%> the only issue is the links and their labels change de...

Expire the page after submission

I'm implementing an iAuth form for a credit application in a J2EE container (JSTL+JSP+Stripes). The vendor states in the implementation guide: Expire the “Questions” page after answers submission When performing iAuth transactions you will need to “expire” the page on which the consumer's questions will be displayed after they h...

how to transfer value from one jsp page to second jsp page

i have one value called titleValue at one jsp page called titleValue..i need to show this value at second jsp page.. could you please tell me how to show this value at second page or how to x:out $titleValue at second page? this is my code at first page : <x:set select="title" var="titleValue" scope="session"/> <x:out select="$titleVa...

Can you put a <c:cout> tag inside the `value` attribute of a <c:set> tag?

I want to output the value of the xzy variable into the value of the abc variable. <c:set var="abc" value="<c:out value="${xyz}"/>"/> I'm getting an error (unterminated <c:set> tag) when I do this. How do you do this? ...

how to import a jsp from temp directory in jstl

I have some dynamically generated jsp content I'd like to (jstl) c:import into another jsp page. Currently I have the dynamically generated jsp written to a file in the servlet temp directory (javax.servlet.context.tempdir) but can't work out how I can import it since it is outside the servlet context. Is there a way to import a jsp from...

applying JSP/JSTL's <c:url> to a path inside a servlet

In our JSP pages, we use extensively. Works great, rewrites the URL to deal with sessionids, contexts, etc. But now we need to do some of this work inside a class that takes an HttpServletRequest and HttpServletResponse as part of the Spring Security specification. How do I apply a type transformation to a path in a servlet? I gues...

Determine secure url in JSP with spring security

Like many websites, I have a login popup on every webpage of my site. Most of these pages are http (non-secure). But the login mechanism has to post to a secure url. All this works great. The problem is the secure url changes in the various dev environments, staging and different production environments. So not too big of a deal, I ...

JSTL tags not working in plain html file

I have plain HTML file and I want to include some JSTL tags in that, first I am trying whether this works. But somehow JSTL tags are now showing value after rendering. Here is the code: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:wicket="http://wicket.apache.org/" xmlns:c="http://java.sun.com/jstl/core"&gt; <body> <c:...