jstl

How to use format date as “yyyy-MM-dd” with JSTL? [duplicate]

本秂侑毒 提交于 2019-12-22 03:38:07
问题 This question already has answers here : Convert and format a Date in JSP (6 answers) Closed 3 years ago . I want to take date from DB and display on jsp: 2014-04-02 instead of: 2014-04-02 00:00:00.0 On jsp I tried to use c:fmt tag for formatting date: <div class="form-group"> <span><fmt:message key="task.start"/></span> <input class="form-control" id="firstDate" placeholder="<fmt:message key="task.start"/>" name="start_date-${task.taskId}" <fmt:formatDate value="${task.startDate}" var=

How to debug JSTL?

天涯浪子 提交于 2019-12-22 01:39:29
问题 I'm using SpringSource Tool Suite (with Roo) and have some success. What bothers me though is that I don't know how to debug tag library-stuff. I may add breakpoints but it never stops at them. What I'm looking for is a dump of all current variables in the context. Up until now I did something like: <c:forEach items="${data}" var="item"> <c:out value="${item}"></c:out><br /> </c:forEach> Sadly, that's difficult to read and also not pretty straightforward. What can I do to improve this? 回答1:

maven中pom.xml引入jar包小结

拟墨画扇 提交于 2019-12-22 00:43:53
用maven中的pom.xml引入包非常方便,在这我就记录一下我经常用的几个设置,配完pom.xml后只需reimport即可(不断更新中): junit: 用于测试 <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.10</version> <scope>test</scope> </dependency> guava:google用于优化java原生类的扩展包 <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>18.0</version> </dependency> log4j: 日志相关扩展包,用system.out.print和printstacktrace在实际中是不被允许的 <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.9</version> </dependency> servlet:不多说,web相关 <dependency> <groupId>javax.servlet</groupId> <artifactId

calling another variable using a variable value as parameter in jstl

耗尽温柔 提交于 2019-12-21 23:10:34
问题 the logic is somehow like this: <c:set var="vehicle" value="car"> <c:set var="car" value="ferrari"> since the value of ${vehicle} = "car" which is also the name of the variable with the value of "ferrari" i access it indirectly using ${'${vehicle}'} but it doesn't seem to work. Can someone help me with this. thanks 回答1: This kind of things doesn't usually work in java (there's no eval statement). In this case however, the variables are bound to the request context, so I guess you could access

calling another variable using a variable value as parameter in jstl

北战南征 提交于 2019-12-21 22:58:07
问题 the logic is somehow like this: <c:set var="vehicle" value="car"> <c:set var="car" value="ferrari"> since the value of ${vehicle} = "car" which is also the name of the variable with the value of "ferrari" i access it indirectly using ${'${vehicle}'} but it doesn't seem to work. Can someone help me with this. thanks 回答1: This kind of things doesn't usually work in java (there's no eval statement). In this case however, the variables are bound to the request context, so I guess you could access

Using enum in JSTL

我们两清 提交于 2019-12-21 20:25:43
问题 I am trying to do some website development using jstl and I run into the following problem: Here I am trying to create a dropdown, where the displayed value is the country names, and the value is the country code. To do this I have the following enum in the backend java code: public static enum CountryCodes implements EnumConstant { USA, CAN, AUS, GBR, DEU, ESP, GUM, IND, ISR, MEX, NZL, PAN, PRI; public final String toCountry(){ switch(this){ case USA: return "United States"; case CAN: return

What's the difference between the various JSTL libraries out there and which to use?

南楼画角 提交于 2019-12-21 17:18:43
问题 I'm puzzled because of build and run errors that mislead me. From them, I can't quite figure out what the distinction is between the various JavaServer Page Standard Tag Libraries. For instance, I see: jstl.jar (in Apache Tomcat) jstl-1.2.jar (in Tomahawk examples) jstl-impl.jar (in GlassFish) In times past, I've used (and recently recovered and have stored privately against disaster) from javax.servlet.jsp.jstl jstl-api-1.2.jar jstl-impl-1.2.jar These latter are the only ones I seem to be

Using java.time.LocalDate with JSTL <fmt:formatDate> action

折月煮酒 提交于 2019-12-21 13:03:26
问题 I haven't been able to figure out how to display a java.time.LocalDate value in a JSP. In my JSP, I have this: <fmt:formatDate value="${std.datum}" type="date" pattern="dd.MM.yyyy" var="stdDatum" /> The std.datum is of type java.time.LocalDate. When rendering the JSP I get this exception: javax.el.ELException: Cannot convert 2015-02-14 of type class java.time.LocalDate to class java.util.Date I'm assuming it's the conversion? So is it possible to format an instance of LocalDate class with

Setting SearchContainer in portlet to use it in JSP using EL and JSTL

余生长醉 提交于 2019-12-21 12:42:44
问题 I am trying to use SearchContainer in my liferay application. Currently I've to use JSP Scriplets to set the results in <liferay-ui:search-container-results> tags. This is the snippet so far: <liferay-ui:search-container emptyResultsMessage="there-are-no-courses" delta="5"> <liferay-ui:search-container-results> <% List<Course> tempResults = ActionUtil.getCourses(renderRequest); results = ListUtil.subList(tempResults, searchContainer.getStart(), searchContainer.getEnd()); total = tempResults

JSTL fmt:message and resource bundle

此生再无相见时 提交于 2019-12-21 12:35:59
问题 I want to set the "dir" property of my table from resource bundle based on the locale. Here is snippet: <fmt:setBundle basename="class.path.to.resource.bundle"/> <table align=center class="" dir=<fmt:message key="registration.direction"/>> When the page renders I get this: <table align=center dir=???registration.direction???> I have two resource bundles for english and arabic. registration.direction = ltr -> English registration.direction = rtl -> Arabic Please tell what I am doing wrong? The