tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geir Magnusson Jr." <ge...@optonline.net>
Subject Re: Taglibs Article
Date Sat, 26 May 2001 03:11:18 GMT
Nick Bauman wrote:

> As far as mixing presentation logic and business logic together, well, you
> can do that with Velocity, too. Although it makes you think longer and
> harder about it. Here's a recent template snippet I wrote. This is something
> you wouldn't necessarily be proud of doing with Velocity.
> 
> ----8<----
> 
> #foreach( $event in $events )
>   $yapper = $meeting.getParticipation( ((MeetingEvent)$event).getFromId() )
>   #if( $repRole.equals($yapper.getRole() )
>     $repId = $yapper.getParticipantId()
>     <font color="$black"><b>$yapper.getName()</b></font>
>   #else
>     <font color="$blue"><b>$yapper.getName()</b></font>
>   #end
>   #if ( $event.getClass().getName().equals($chatEventType) )
>     ((com.webhelp.emeeting.events.ChatEvent)$event).getStoredData() <br>
>   #else if( $event.getClass().getName().equals($urlPushedEventType) )
>     <a
> href="((com.webhelp.emeeting.events.URLPushedEvent)$event).getStoredData()">((com.webhelp.emeeting.events.URLPushedEvent)$event).getStoredData()</a><br>
>   #end
> #end

Just out of idle curiousity, why does it look like you are attempting to
do a cast with the 

((com.webhelp.emeeting.events.URLPushedEvent) $event )

bit?

Velocity has no such thing as a cast... -> it will introspect and find
getStoredData() on it's own...

And for fun, can someone translate that into JSP tags to see what it
would look like?

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Mime
View raw message