This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

recurring JSP problem

 
Dan Murphy
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here's an example of the kind of problem I have all the time with JSPs:

I have a Date object stored as a request-scoped attribute. In the web-page itself I want to show something like:

Year 1978, Month 6, Day 30

Extracting these fields in Java code is trivial, but how do I do it in a JSP without resorting to scriptlet code? I can't use a static method and call it via EL, because there's no way to pass parameters to these methods. I suppose I could write my own tag library, but that seems like an awful lot of trouble for something so simple, any suggestions?

(BTW, if anyone knows of a tag library that already provides the date functionality required, please let me know.)

Thanks in Advance,
Dan
 
Anirvan Majumdar
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it might just be possible to achieve what you want using JSTL. Perhaps this site may be of some assistance in this regard.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic