tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mck <...@apache.org>
Subject Re: Can I create a regex that matches an optional parameter?
Date Tue, 25 Feb 2014 10:52:41 GMT

>   <definition name="layout" template="/WEB-INF/layout/web.jsp"/>
>   <definition name="layout.mob" template="/WEB-INF/layout/mob.jsp"/>
>   <definition name="layout.tab" template="/WEB-INF/layout/tab.jsp"/>
>   <definition name="REGEXP:home(\.(mob|tab))?" extends="layout{1}">
>     <put-attribute name="heading" value="Home" />
>     <put-list-attribute name="body">
>       <add-attribute value="/WEB-INF/views/home.jsp" />
>     </put-list-attribute>
>   </definition>


Thanks.
The code ends up looking for "layoutnull" instead of "layout".

This comes from in RegexpDefinitionPatternMatcher.createDefinition(..)
the call to matcher.group(i) returning null.

Rather than fix it there though i'd rather put the fix in lower down in
PatternUtil.replacePlaceholders(..) so that any nulls in the vars
parameter are always replaced with blanks.

see http://thread.gmane.org/gmane.comp.apache.tiles.scm/576

Feel free to checkout this code, switch to "TILES_3_0_X" branch, build,
depend on tiles-core-3.0.4-SNAPSHOT and test.
 Feedback would be great if you get the chance.

~mck
 

-- 
“So much of what we call management consists in making it difficult for
people to work.” - Peter Drucker 

| http://github.com/finn-no | http://tech.finn.no |


Mime
View raw message