• Post Reply Bookmark Topic Watch Topic
  • New Topic

fmt:formatDate problem

 
shaf maff
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
  • 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:
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!