Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>That's very unfortunate. It look like you can't go around this. Your best bet is then to create custom EL functions which does the same. Here's an example how you could replace <code>fmt:formatDate</code>.</p> <p>First create an EL functions class (just a simple static class):</p> <pre><code>package com.example; import java.text.SimpleDateFormat; import java.util.Date; public final class Functions { private Functions() { // } public static String formatDate(Date date, String pattern) { return new SimpleDateFormat(pattern).format(date); } } </code></pre> <p>Then create a <code>/WEB-INF/functions.tld</code> (note: JSP 2.1 targeted, not sure what your GAE supports, it's maybe Servlet 2.4, if so then you need to redeclare it as JSP 2.0 taglib):</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" version="2.1"&gt; &lt;display-name&gt;Custom Functions&lt;/display-name&gt; &lt;tlib-version&gt;1.0&lt;/tlib-version&gt; &lt;uri&gt;http://example.com/functions&lt;/uri&gt; &lt;function&gt; &lt;name&gt;formatDate&lt;/name&gt; &lt;function-class&gt;com.example.Functions&lt;/function-class&gt; &lt;function-signature&gt;java.lang.String formatDate(java.util.Date, java.lang.String)&lt;/function-signature&gt; &lt;/function&gt; &lt;/taglib&gt; </code></pre> <p>Then you can use it as follows in your JSP:</p> <pre class="lang-xml prettyprint-override"><code>&lt;%@taglib uri="http://example.com/functions" prefix="f" %&gt; &lt;jsp:useBean id="date" class="java.util.Date" /&gt; ... &lt;p&gt;Current year: ${f:formatDate(date, 'yyyy')}&lt;/p&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload