jstl

How can I check if a resource bundle key does not exist using JSTL tags?

I have a resource file that will have some optional keys. If the optional resource key is not present, I set a default instead. It appears that there is no easy way to determine if a key exists in the resource bundle. So this is what I'm doing to get around it. <fmt:message var="title" key="login.reg.signup.${signupForm.regfrom}.title"...

Is there an ASP MVC equivilent to JSTL tags?

Are there any libraries that support JSTL style coding in an ASP MVC view? I much prefer <c:forEach var="c" items="${Customers}"> <c:out value="${c.Name}"/><br/ > </c:forEach> to <% foreach(Customer c in customers) { %> <%= c.Name %><br/ > <% } %> ...

Displaytag library - detecting a paging request

Hi, I'm currently developing a portlet for Liferay (using the Spring MVC framework). Now I just used the displaytag library for implementing paging on a list I'm displaying on the portlet. My problem now is that I would need to detect whether the current request has been started by the paging control of the displaytag library. What I ...

Formatting file sizes in Java/JSTL.

I was wondering if anyone knew of a good way to format files sizes in Java/JSP/JSTL pages. Is there a util class that with do this? I've searched commons but found nothing. Any custom tags? Does a library already exist for this? Ideally I'd like it to behave like the -h switch on Unix's ls command 34 -> 34 795 -> 795 2646 -> 2.6K 2...

Looking for a single package for JSF SUN-RI with JSTL

For those of you using JSF + JSTL, is there any provider that provides both these jars in a single package (zip etc.)? (I'm looking for one package due to limitations of a particular framework that I'm using to write an Eclipse plugin) Any pointers are welcome. ...

Avoid looping xml in jstl

I would like to do something like this: <x:out select="$productXML/product/sizes/size[<c:out value='${param.sizeIndex}'/>]" escapeXml="false"/> but I think the only way to do it is like this: <x:forEach var="size" begin="${param.sizeIndex}" end="${param.sizeIndex+1}" select="$productXML/product/sizes/*"> <x:out select="$size" e...

jstl/jsp - iterating over a vector of beans.

I have a vector of beans that holds information I want to display in my jsp page. I'm currently just using standard java expressions to display this, I want to look into using jstl to separate concerns. Is this possible, and how? I've been googling but I can't seem to find anything. ...

Keeping queries out of JSP - how?

I'm a big fan of keeping application logic in the servlet, and keeping the JSP as simple as possible. One of the reasons for this is that any good web designer should be able to expand upon his HTML knowledge to build in a few JSTL tags to do simple iteration, access beans, etc. We also keep the more complex/ajax/js components behind a t...

JSTL taglib URI is obsolete?

I've been checking out Spring MVC tutorial and copied this small JSP code from there: <%@ page session="false"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <html> <head><title>Training, Inc.</title></head> <body> <h2><c:out value="${message}" /></h2> </body> </html> There is a string set for ...

GWT/Eclipse/Jetty issue: Jasper can't resolve tag libraries

I'm trying to get GWT Hosted mode working in Eclipse, à la this HOWTO. Servlets work fine, as does my GWT code, but all my JSPs fail because with errors such as the following: [WARN] /view/lniExecutiveSummary.htm org.apache.jasper.JasperException: /WEB-INF/jsp/lni/lniExecutiveSummary.jsp(1,1) The absolute uri: http://java.sun.com/jsp/...

Check a collection size with JSTL

How can i check the size of a collection with JSTL? Something like: <c:if test="${companies.size() > 0"> </c:if> ...

how do you read locale information from session?

The following bit of code sets the Locale from lang param on querystring. <c:if test="${param['lang'] != null}"> <fmt:setLocale value="${param['lang']}" scope="session"/> </c:if> How do I now read that variable? I know its a bit noobish. I need a bit of conditional logic to display one language link if the local hasn't been set ...

Get current filename in JSP

Is there a way to get which JSP is currently rendered, with JSTL or Struts (or without)? like _ _ file _ _ in Python and PHP? ...

Is it possible to use JSTL to display a date in the client's timezone?

In Javascript, I have this function to display the current date on our page header: <SCRIPT language="Javascript"> var today = new Date(); document.write(today.toLocaleDateString()); </SCRIPT> I would like to do this via JSTL, but I'm not sure if it's possible. So far, I have this fragment of code: <jsp:useBean id="date" cla...

How can i check if an attribute exists with jstl?

E.g. <c:if test="${post}"> <h3>${post.title}</h3> </c:if> ...

displaytag problem

Hello everybody. I am trying to use displaytag for the first time and having a problem with the displaytag, that i seems not be able to solve. I googled for solution, but couldn't find nothing over internet. Everything else is working it is the only thing thats not working. Pretty much i am trying just do simple display of table. the ...

I met problem trying to use EL in JSTL tags

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 this: <c:out value="${header['host']}"/> But next code executes well: ${header["host"]} <c:out value="hello"/> I added js...

Difference between '#','%' and '$'

I'm new to struts2 and confused by the '#','%' and '$' element. There are some usages like: ${user.name} %{user.name} <s:radio list="#{key1:value1,key2:value2}" /> Could any give me an explanation and examples? ...

JSTL access a map value by key

I have a Map keyed by Integer. Using JSTL, how can I access a value by its key? Map<Integer, String> map = new HashMap<Integer, String>(); map.put(1, "One"); map.put(2, "Two"); map.put(3, "Three"); I thought this would work but it doesn't (where map is already in the request's attributes): <c:out value="${map[1]}"/> Follow up: I tr...

Error occuring while using for-each loops & generics in j2EE

I am designing a website-based project wherein I first designed my logical layer in Java J2SE application development. Then I made the GUI in J2EE for website. I am importing my J2SE files in J2EE architecture using JSTL and I will call the data using this only. But it is giving me an error as follows: for-each loops -- for-each loops ...