struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <>
Subject Re: OT jstl/el question
Date Wed, 28 Jul 2004 22:31:42 GMT
On Wed, 28 Jul 2004 15:36:08 -0600, Nathan Maves <> wrote:
> I am using the EcpressionEvaluationManager class of jstl in my own
> custom tag.
> This used to work but now things are a bit weird.
> What I need it to be able to pass an Object (i.e. Date) to my custom
> tag.  I think since I have enabled JSP 2.0 is now evals the var into a
> String before it is sent to the custom tag.  Has anyone seen this or
> know how to accomplish this task.

That's correct ... in a JSP 2.0 page, the page itself evaluates the
expressions for you.  The nice thing is that this works everywhere,
even in template text; not just in attributes of custom tags that know
how to evaluate expressions.

If you have a tag like this that needs to take a date:

  <my:customTag startDate="${somebean.somedate}"/>

then you need to make sure that your tag implementation class uses a
Date as the property type for this attribute:

    private Date startDate;
    public void setStartDate(Date startDate) {
        this.startDate = startDate;

and, of course, that the expression actually points at a property of
type Date.  Your tag class need not know anything about evaluating
expressions itself.

> Nathan


PS:  While you are messing around with your tag implementation class,
you might want to experiment with using the new SimpleTag APIs instead
of the classic Tag handler API.  This API is new in JSP 2.0, and makes
it *much* easier to write a custom tag implementation class.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message