This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes print server time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "print server time" Watch "print server time" New topic
Author

print server time

Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
How do I print server time in a jsp??
Do we have any implicit objects to access this?
I am using jstl and el.

thanks
Brian
[ October 19, 2007: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
Thanks Bear,

Using a Bean just didn't make sense, butI guess there is no other way.
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
just a correction, 'var' should be 'id'
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Originally posted by Brian Percival:

Using a Bean just didn't make sense, butI guess there is no other way.

Why not? The EL is designed to work with beans. They are an integral part of the whole JSTL/EL concept.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Originally posted by Brian Percival:
just a correction, 'var' should be 'id'

Indeed... slipped into JSTL syntax by mistake.
Brian Percival
Ranch Hand

Joined: Jun 23, 2004
Posts: 163
Bear,

you are right.. jstl/el is designed to work with Beans. But useBean ussage would mean, we need to have extra knowledge of knowing if a class fits the Bean rules.

I would rather be comfortable somehow using c:set and then accessing the values I want.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

Originally posted by Brian Percival:
you are right.. jstl/el is designed to work with Beans. But useBean ussage would mean, we need to have extra knowledge of knowing if a class fits the Bean rules.
I don't get the point,. This applies no matter how the bean gets instantiated. If it's going to be a scoped variable accessible by the EL, it must be a bean.

I would rather be comfortable somehow using c:set and then accessing the values I want.
<c:set> has no means to cause a bean to become instantiated as that is not its purpose. That's what <jsp:useBean> is for.

If you'd rather not use <jsp:useBean> on a page for whatever reason (which I still don't get), instatiate the bean in the servlet controller and set it as a scoped variable prior to forwarding to the page.
 
 
subject: print server time