• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Display string value in s:date tag

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
We migrated from struts 2.0 to 2.5.5.
In 2.0 we were able to display string value in s:date.
for example <s:date name="%{new java.util.Date(planedVisitDate)}" format="mm-dd-yyyy" />
Here planedVisitDate is a String property in Person class(private String planedVisitDate)

After migrating to 2.5.5, we could not able to display the value. Any solution will helps us a lot.
Thanks in advance.
Ramprasad
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please let us know if you have posted the same question to other forums.  We don't want to duplicate effort or waste others' time.  
I'm not sure why it would work in 2 and not 2.5.  My wild guess is that the Date constructor is failing (you should see an exception if this is the case).  
Given that the Date constructor that takes a String has been deprecated since Java 1.1, I wouldn't use it.  I'd either use DateFormat.parse in place of it or create a method in Person that returns a Date object. Personally, I'd prefer the latter to keep Java code out of the JSP.
 
ram prasadvarma
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your response.
We don't know struts has removed support for deprecated API.
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ram prasadvarma wrote:
We don't know struts has removed support for deprecated API.



Struts didn't remove anything.  The Java API has the deprecated method.  I said in my post that I'm not sure what's going on, but my first step in solving it would be to use supported methods.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic