Hi,
JSTL provides the fmt:formatDate tag for formatting dates. The way to use it is:
Now, in an application you do not want to specify the hardcoded format of "dd/MM/yyyy" in all your jsp's or other pages. Especially since you need to ensure that the format is configurable for the user.
One possible solution is that you specify a form...
I am trying to use the c:import and x:parse tags within an x:forEach.
Is this possible?
If not, what is another way to import multiple xml sources depending on parsed data from another xml source?
<x:forEach select="$sitemap/pages/page" varStatus="status">
<x:set var="location_id" select="@id"/>
<c:import url="xml/pages/page${...
Hi,
I'm doing a division in a JSP and I'd like to round the result - how should I do this?
i.e.
<c:set
var="expiry"
value="${(expire.time - now.time) / (60 * 1000)}"/>
...how do I round the result?
Thanks,
...
Hi all,
I'm a jstl newbie so probably this question will sound to you funny.
Anyway, I have a model with a List as property and I'd like to fill this with a list of values (chosen from a list of checkboxes). I'm using the useBean tag in the form-processing jstl page, but doing this:
<jsp:useBean id='subscription' class='Subscription'>...
I'm using Richfaces JSF and I want to iterate over an Map<Object,Object>. I see many examples on Sun forums and other sites but in my case it doesn't work. Here is my XHTML code:
<c:forEach items="#{order.customOptions}" var="option">
<h:outputText value="this text does not print" />
<h:outputText value="#{option.value.name}" />...
I've been trying to evaluate if this array list is empty or not but none of these have even compiled:
<c:if test="${myObject.featuresList.size == 0 }">
<c:if test="${myObject.featuresList.length == 0 }">
<c:if test="${myObject.featuresList.size() == 0 }">
<c:if test="${myObject.featuresList.length() == 0 }">
<c:i...
I'm having a problem with JSTL formatDate when displaying dates from MySQL database. I am using DAO layer for communication with database and in beans, dates are stored in java.util.Date objects. In JSP the code looks like this:
<fmt:parseDate value="${season.startDate}" pattern="dd.MM.yyyy."/>
When I try to run this page I get java.te...
Hi All,
I have a model with this method:
public List<String> getPriviledgeNames()
I'm trying to display a list of checkbox in my jstl page, and I'd like to checked only the ones which their name is in the list returned from my model.
So I have something like:
<li>
<input type="checkbox" name ="priviledge" id="CheckBox2" class="c...
Hello! Thanks in advance for taking a look :)
I'm hard at work on a J2EE web app (in JDeveloper) and recently added some functionality that required JSTL, and I've hit a little bit of a snag. Whenever I try to deploy my war on Weblogic 11g, I get the following error on the console:
[02:05:43 AM] Must choose only one of
libraries: ...
I need to hide an element if certain values are present in the JSP
The values are stored in a List so I tried:
<c:if test="${ mylist.contains( myValue ) }">style='display:none;'</c:if>
But, it doesn't work.
How can I evaluate if a list contains a value in JSTL, the list and the values are strings.
...
I've been trying to get this to run, but I can't. I'm using Eclipse Galileo, Tomcat 5.5.23 and have several JSTLs around. My latest try was to use the glassfish jar file "jstl-impl-1.2.jar". I placed it in tomcat's shared lib, added it as external jar into my eclipe project and exported it.
Could anybody tell me, which jars to load in ...
I have:
public enum MyEnum{
One, Two, Three
}
From controller, I put in the model:
HashMap<MyEnum, Long> map = new HashMap<MyEnum, Long>();
map.put(MyEnum.One, 1L);
mav.addObject( "map", map);
How do I in my JSTL access the object in the map for key enum MyEnum.One, in a neat way?
${map['One']} //does not seem to work...
nor ...
Hi all,
I don't like JSF but I need to solve this problem with it, I am working in "pure" JSF.
So this is what I baisicly need but I don't know how to accomplish it with JSF:
<c:set var="total" value="0"></c:set>
<c:forEach var="item" items="${cart}">
<tr>
<td>${item.product.name}</td>
<td>${item.product.price}</td>
...
How to check for Double.NaN in JSP with JSTL tags?
...
Hi,
We are going to use JSTL and custom JSTL-tags for some sort of template-engine in our JSP/spring-project.
Is there a way to create a tag that looks similar like this:
<div id="site">
<div id="header">Some title</div>
<div id="navigation"> SOME DYNAMIC CONTENT HERE </div>
<div id="content"> ${content} </div>
<div id...
I was using a properties.xml file which i stored with java.util.properties storeToXML.
but storeToXML always set a doctype like:
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
now i use JSTL XML to check for the properties:
<c:import url="${settingsPath}" var="xml" />
<x:parse xml="${xml}" var="doc" />
<x:c...
Hi, is it possible to do something like this in JSTL:
<div class="firstclass<c:if test='true'> someclass</c:if>">
<p>some other stuff...</p>
</div>
Is there any way to get this to work, or is there a better way to add a class by looking at a JSTL-if-statement?
...
Hi,
when my Map contains key with dot in their name I cannot access the corresponding value directly with the usual code:
${recordForm.map['records.key']}
Is there a way to escape the dot? Or do I have to resort to loop through all values and check against the key? (I know the iteration works).
Thanks!
...
Hi Guys,
just was wondering if there is a way to access a method from my class without creating a custom taglib.
Example
I got a class which provides 4 methods: hasDisplay(), hasCreate(), hasDelete() and hasEdit() - all of them just returning a boolean value.
From my jsp I just want to
<c:if test="{ar.hasEdit}"></c:if>
But this on...
Hello, could anybody tell me how to parse XML file inside a JSF page?
The thing's that I've got XML file and want to put some data from it into my JSF page. My first thought was to include JSTL Core and XML libs and to do something like this:
<c:import var="some-info-doc" src="some-info.xml" />
<x:parse var="some-info-xml" xml="some-...