• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

fmt:formatDate problem

 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

I am trying to format a date which is a string using the formatDate JSTL tag, but it prints out the following error:



See code below:
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shaf maff wrote:According to TLD or attribute directive in tag file, attribute value does not accept any expressions


This is usually a sign that you have the JSTL mis-configured. Be sure that you are using the right version of the JSTL for your level of JSP and that you have your deployment descriptor correctly declared. It's all in the JSP FAQ.

// In Servlet
String dateSent = 2009-03-01 05:16:20.0;


Please read this with regards to wasting people's time with red herrings. This can't possibly be your Servlet code as it won't even compile.

<fmt:formatDate pattern="yyyy-MM-dd hh:mm:ss" value="${dateSent}" />[/code]


Does the JSTL specification state that a string is an acceptable form of input here?
 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

This is usually a sign that you have the JSTL mis-configured. Be sure that you are using the right version of the JSTL for your level of JSP and that you have your deployment descriptor correctly declared. It's all in the JSP FAQ.

Well it works fine for my core and function tags, its just the fmt that is causing problems at the moment.

Does the JSTL specification state that a string is an acceptable form of input here?

See for yourself: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatDate.html

Sorry about the red herrings - Thats not all the code, its just the relevant bit for the people who want to know how the variable is initialised.
 
Bear Bibeault
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

shaf maff wrote:Well it works fine for my core and function tags, its just the fmt that is causing problems at the moment.


Do you not think that it would be wise to verify the configuration?

Does the JSTL specification state that a string is an acceptable form of input here?

See for yourself: http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fmt/formatDate.html


That is in error. The JSTL Specification clearly states that a java.util.Date is expected.

Sorry about the red herrings - Thats not all the code, its just the relevant bit for the people who want to know how the variable is initialised.


It doesn't matter that that's not the complete code. The code you post should be your real code. This can't be as it's not even valid Java syntax, and as such, not relevant.
reply
    Bookmark Topic Watch Topic
  • New Topic