jsp - Sitemesh mapping multiple decorators won't work as expected -
i trying decorate page multiple decorators using sitemesh 3. problem occurs when add more pages, of pages gets decorated decorator leading not decorated page.
here trying do:
- decorate
/
,/login
2 decorators - decorate
/welcome
2 different decorators
the sitemesh3.xml
far:
<?xml version="1.0" encoding="utf-8"?> <sitemesh> <mapping> <path>/</path> <decorator>/decorator1.jsp</decorator> <decorator>/decorator1-2.jsp</decorator> </mapping> <mapping> <path>/login</path> <decorator>/decorator1.jsp</decorator> <decorator>/decorator1-2.jsp</decorator> </mapping> <mapping> <path>/welcome</path> <decorator>/decorator2.jsp</decorator> <decorator>/decorator2-2.jsp</decorator> </mapping> </sitemesh>
the problem /welcome
gets decorated decorator1
, decorator1-2
can explain did missed here?
btw, can use multiple <path>
inside mapping map multiple locations on 1 or more decorators or each path must declared separately.
i know can use /*
map pages if want like:
<mapping> <path>/admin/*</path> <path>/manage/*</path> <path>/secured/admin/*</path> <decorator>decorator.jsp</decorator> </mapping>
for second question, answer yes. can add multiple <path>
in <mapping>
, paths decorated.
first question, if decorate / or /* decorators, applied page. means, if want decorate pages, please not use / or /*. below configurations come current project.
<mapping path="/*" decorator="/web-inf/decorators/menu.ftl"/> <mapping> <path >/catalog/*</path> <path >/attribute/*</path> <decorator>/web-inf/decorators/product_menu.ftl</decorator> <decorator>/web-inf/decorators/menu.ftl</decorator> </mapping> <mapping> <path >/member/comment*</path> <decorator>/web-inf/decorators/comment_menu.ftl</decorator> <decorator>/web-inf/decorators/menu.ftl</decorator> </mapping>
as can see, pages decorated menu.ftl, , have specific decorator other pages.
Comments
Post a Comment