You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nathan Maves <Na...@Sun.COM> on 2004/07/28 23:36:08 UTC

OT jstl/el question

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.

Nathan


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: OT jstl/el question

Posted by Nathan Maves <Na...@Sun.COM>.
Worked perfect and I love the new SimpleTagSupport!

Not sure why I did not send this email out this morning!

At first I thought JSP 2.0 was more of a hindrance but I now see the 
light :)


Thanks for the help Craig.


On Jul 28, 2004, at 4:31 PM, Craig McClanahan wrote:

> On Wed, 28 Jul 2004 15:36:08 -0600, Nathan Maves 
> <na...@sun.com> 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
>
>
> Craig
>
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: OT jstl/el question

Posted by Craig McClanahan <cr...@gmail.com>.
On Wed, 28 Jul 2004 15:36:08 -0600, Nathan Maves <na...@sun.com> 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


Craig

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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org