struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hookom, Jacob" <Jacob.Hoo...@redline.mckhboc.com>
Subject RE: OT jstl/el question
Date Thu, 29 Jul 2004 14:49:51 GMT
If I'm developing tags for JSP 2.0, then I don't have to explicitly call the
ExpressionEvaluator on an attribute within the tag since I will be receiving
the result of the expression evaluation?

I was thinking of doing that with JSF tags also using the DynamicAttributes
interface to allow possibly more flexibility with minimal changes in
reflecting the HTML version of the tag.  This way you just create
setters/getters for JSF specific properties, everything else would be taken
care of the DynamicAttributes behavior, dumping the results right into a Map
within the 'setDynamicAttribute' method.  Processing the value bindings is
just a matter of iterating over the map's entries and producing either a
ValueBinding or setting on the Attribute map.

-Jacob

> -----Original Message-----
> From: Craig McClanahan [mailto:craigmcc@gmail.com]
> Sent: Wednesday, July 28, 2004 5:32 PM
> To: Struts Users Mailing List
> Subject: Re: OT jstl/el question
> 
> On Wed, 28 Jul 2004 15:36:08 -0600, Nathan Maves <nathan.maves@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


Mime
View raw message