Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>&lt;s:set/&gt;</code> tag places values on to the ValueStack, which isn't conveniently available from scriptlets (I would recommend you avoid scriptlets anyway).</p> <p>First, on the subject of:</p> <pre><code>&lt;s:if test='&lt;s:property value="priority"/&gt; == 1'&gt; /*Some img to display here*/ &lt;/s:if&gt; </code></pre> <p>Try this:</p> <pre><code>&lt;s:if test="%{priority == 1}"&gt; /*Some img to display here*/ &lt;/s:if&gt; </code></pre> <p>You can also use JSP EL:</p> <pre><code>&lt;c:if test="${action.priority == 1}"&gt; /*Some img to display here*/ &lt;/c:if&gt; </code></pre> <p>As for the date, asdoctrey mentioned, you could do this conversion in your action class. I've handled this in the past using a custom JSP function.</p> <h3>The TLD</h3> <pre><code>&lt;taglib xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" version="2.0"&gt; &lt;description&gt;&lt;![CDATA[JSP Functions]]&gt;&lt;/description&gt; &lt;display-name&gt;JSP Functions&lt;/display-name&gt; &lt;tlib-version&gt;1.0&lt;/tlib-version&gt; &lt;short-name&gt;ex&lt;/short-name&gt; &lt;uri&gt;http://www.example.com/tags/jsp-functions&lt;/uri&gt; &lt;/taglib&gt; </code></pre> <h3>The Java</h3> <pre><code>/** * The JSTL fmt:formatDate tag expects a Date and the fmt:parseDate * apparently expects to parse from a String representation of the * date. This method allows you to easily convert a long into a Date * object for use in fmt:formatDate. * &lt;p/&gt; * The long passed in to this method is expected to be a UNIX epoch * timestamp (number of milliseconds since Jan. 1, 1970). For more * details, see {@link java.util.Date#Date(long)}. * * @param epoch The long to convert. Expected to be an epoch timestamp. * @return A new Date object. */ public static Date longToDate(final long epoch) { return new Date(epoch); } </code></pre> <h3>The JSP</h3> <pre><code>&lt;%@ taglib prefix="ex" uri="http://www.example.com/tags/jsp-functions" %&gt; ${ex:longToDate(action.dateAsLong)} </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.
    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