Thanks Hans! :)
I was just trying to be lazy and do the creation of the bean in the fmt tag.
:-P
-Tim

-----Original Message-----
From: Hans Bergsten [mailto:hans@;gefionsoftware.com]
Sent: Friday, October 18, 2002 1:44 PM
To: Tag Libraries Users List
Subject: Re: JSTL on the fly


Chen, Gin wrote:
> Does JSTL EL support creating objects?
> 
> for example the following sniplet:
> 
> <center><%= new java.util.Date() %></center>
> 
> can i do this using jstl tags without first having to set up a bean?
> 
> in particular. I want to use the fmt tag to format this date.

No, but you can use the standard <jsp:useBean> action to create an
instance of java.util.Date:

   <jsp:useBean id="now" class="java.util.Date" />
   <fmt:formatDate value="${now}" ... />

Don't be scared by the "bean" term; a bean is just a class with a
no-argument constructor (all that's needed for <jsp:useBean>) and
methods using the get/setPropertyName() naming convention (needed
to access properties with EL expressions or <jsp:get/setProperty>).

Hans
-- 
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com
JavaServer Pages        http://TheJSPBook.com


--
To unsubscribe, e-mail:
<mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:taglibs-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@;jakarta.apache.org>

Reply via email to