tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nick Bauman" <n...@cortexity.com>
Subject Re: Taglibs Article
Date Sat, 26 May 2001 23:34:59 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...

Yeah, I'd discovered that later.... Very cool!

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

I can show you the JSP because this thing started as JSP once. Not pretty, 
but a Java developer would feel at home, thats about all I could say 
positive about it ;)
 
> 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..."


-- 
Nick Bauman
Software Developer
3023 Lynn #22
Minneapolis, MN
55416
Mobile Phone: (612) 810-7406


Mime
View raw message