*
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: 106
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: 106
Thanks. It's working now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic dateTime for an HTML page?