11/22/2002 5:47:55 PM, Nathan Bubna <[EMAIL PROTECTED]> wrote: >yeah, i haven't gotten to see it, but i heard he talked about the >Velocity+Struts stuff in it. i'm hoping it gets more people >looking into and/or using that code. i think there's some good >potential there, but progress has kinda plateaued lately. it >could use some fresh users/contributers to prod things along.
What you and Gabe have setup is already very complete. The only thing I've found to add so far is a convenience error tool to snag the globals. But other than that, it all seems as smooth as silk. I'm missing Tiles of course. Though, I'm thinking that might be soluable. Might just need a different request processor. In the meantime, it wasn't hard to mockup a poor-man's Tiles. I threw up an Action that sets the paths for specified list of ActionForwards into the context. My Velocity templates can then reference these in parse statements to assemble the pages. After the real Action is done, it forward to a "view Action" So, in struts-config, I elements like this <action path="/vm/UnitResult" parameter="title;choice;menu;body;action" name="view" type="us_ok_deq_wqdata.struts.ViewAction" > <forward name="title" path="Search Result" /> <forward name="choice" path="Search Result" /> <forward name="menu" path="/cpu/unitMenu.vm" /> <forward name="body" path="/cpu/staffResult.vm" /> <forward name="action" path="/unit/Search.do" /> </action> Where elements like "menu" and "body" are being included by the base Layout.vm through #parse directives. Velocity also makes it very easy to specify the action from the configuration, so you can the same form to different actions. (Very useful in practice.) But this is really just a hack, and I do think we need to expand the scope of Tiles in 1.2.x so that it can be used with other presentation systems. I've also started to setup some velocimacros that provide the same sort of utility we see in the Struts JSP tags, like the mulitbox and select tags: ## "Multibox" control ## $name The control name shared by the checkboxes ## $labels The master list of checkbox labels ## $values The list of checkboxes that have been set (subset of $labels) ## :TODO: Test in portal application #macro (multibox $name $labels $values) #foreach ($n in $labels)<input type="checkbox" name="$name" value="$n" #foreach ($v in $values)#if($v==$n)checked="checked" #end#end /> $n<br> #end #end ## Select control ## $name The control name ## $value The selected value ## $labels The list of labels for the options ## $values The list of values for the options #macro (select $name $value $labels $values) ## The velocityCounter starts at 1 by default, so we use our own zero-based counter. #set($i=0) <select name="$name"> #foreach ($v in $values) <option value="$v"#if("$v"=="$value") selected="selected"#end> $labels.get($i)</option> #set($i=1+$i) #end </select> #end Here's another one for doing a drop-down date control (in English): ## Drop-down date control (en) ## $day The name for the day ## $dayV The value for the day ## $month The name for the month ## $monthV The value for the month ## $year The name for the year ## $yearV The value for the year ## $yearRange The range of years #macro (dropDate $day $dayV $month $monthV $year $yearV $yearRange) #set($monthLabels = ["---","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct" ,"Nov","Dec"]) #set($monthValues = ["","1","2","3","4","5","6","7","8","9","10","11","12"]) #select($month $monthV $monthLabels $monthValues) #set($dayValues = [1..31]) #select($day $dayV $dayValues $dayValues) #select($year $yearV $yearRange $yearRange) #end These came out an application that can be downloaded here: http://prdownloads.sourceforge.net/wqdata/cpu_20021115.war? download if anyone is interested. I think there's a lot of potential here for making Struts applications eaiser to create, both by handcoders and by GUIS and code generators, like Middlegen's. -Ted. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>