This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Servlets and the fly likes Dynamic dateTime for an HTML page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Dynamic dateTime for an HTML page?" Watch "Dynamic dateTime for an HTML page?" New topic
Author

Dynamic dateTime for an HTML page?

Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 111
I just got this weird assignment:

"You have to write a servlet that generates an HTML page with the current date and time upon a GET request"

Weird part:
"Provide an init-param that can set the dateTime format" (what does that even mean?)

How am I supposed to provide any semantics in an init-param? Isn't it just a pure String?
How do I tell my serlvet which dateTime format it's supposed to take by giving it an init-param?

I don't understand.

Could anyone clarify this please?

Thanks
Julien Coe
Greenhorn

Joined: Jun 27, 2012
Posts: 4
in the XML where you describe your servlets (web.xml) you can add some init-parameters to your servlet:



You can then get them in your servlet with the following code





About the date format, you can check here: Date Format


and use something like that:


Ryan McClain
Ranch Hand

Joined: Nov 27, 2010
Posts: 111
Thanks. It's working now.
 
Have you checked out Aspose?
 
subject: Dynamic dateTime for an HTML page?
 
It's not a secret anymore!