fmt:formatDate cambio de salida por aplicación

When writing a sitemap I have run into this problem: ¿La etiqueta fmt de JSTL no funciona en IE? and solved it using . Great.

Interestingly I ran into it only in a subset of applications running in the same install of Tomcat7.

Is there a mechanism where some apps can have a different locale to others? As far as I can see the boilerplate code is the same as the only differences are is output HTML (not logic). All the fmt tags are using the same initilisation and pattern with the same return type (same data returned to multiple pages).

¡CÓDIGO!

Setup (in page)

<jsp:useBean id="WorkshopLatestUpdateProcessBean" scope="page" class="com.themetacity.beans.WorkshopProcessBean"/>
<c:set var="workshopUpdateDate" value="${WorkshopLatestUpdateProcessBean.lastUpdateDate}"/>

<fmt:formatDate value="${workshopUpdateDate}" pattern="yyyy-MM-dd"/>

The above will give a result of

28-8-12

and another app will give

Tue Aug 28 18:54:38 EST 2012

which is the problem linked to at the top of this questions

preguntado el 28 de agosto de 12 a las 10:08

1 Respuestas

It turns out that this is expected behaviour because I was terrible at initialising the value passed to the tag.

If you pass in uninitialised values it defaults to the time stamp of when the page was rendered as shown in the problem above. Initialise it in the c:set part and all is well.

TL:DR there was no problem and I am bad at this.

Respondido el 13 de Septiembre de 12 a las 12:09

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.