Results 1 to 5 of 5

Thread: sitemesh configuration in spring

  1. #1

    Default sitemesh configuration in spring [problem solved]

    hi, i had use sitemesh in spring.

    here my decorator.xml

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <decorators defaultdir="/WEB-INF/decorators">
    
        <decorator name="main" page="main.jsp">
            <url-pattern>/*</url-pattern>   
        </decorator> 
        
        <decorator name="private" page="private.jsp">
            <url-pattern>/*/admin/*</url-pattern> 
        </decorator>
       
       
    </decorators>
    the problem is when I had a url like this :

    https://localhost:8443/app/admin/user/list.htm

    it apply the "main" decocator instead of "private" decorator. the CORRECT decorator should be "private". but it just not work. (It always work on url pattern of /* only, but not other)

    I not sure am I configure the application correctly, I don't use sitemesh.xml, and i put a filter in web.xml like this:

    Code:
    <filter>
           <filter-name>sitemesh</filter-name>
    	<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
    </filter>
    
    <filter-mapping>
    	<filter-name>sitemesh</filter-name>
    	<url-pattern>/*</url-pattern>
    </filter-mapping>
    I use sitemesh 2.3.

    any idea ?

    kiwi
    ----
    happy hacking !
    Last edited by kiwi; Aug 19th, 2008 at 09:38 AM. Reason: problem solved.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,629

    Default

    Try switching the declarations, not sure if the order of the decorates makes any difference. (/* matches everything so if sitemesh stops looking after he found a match you might be in trouble).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    i had try the order, but is not working also.

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <decorators defaultdir="/WEB-INF/decorators">
    
        <decorator name="main" page="main.jsp">
            <url-pattern>/*</url-pattern>   
        </decorator> 
        
        <decorator name="private" page="private.jsp">
            <url-pattern>/*</url-pattern> 
        </decorator>   
       
    </decorators>
    If i change to both pattern to /*, it will always fall down to the last one. I not sure if I use the wrong url pattern in decorator.xml.

    btw, i use JSP as my decorator, and the view is velocity.

    kiwi
    ----
    happy hacking !
    Last edited by kiwi; Aug 19th, 2008 at 05:51 AM.

  4. #4
    Join Date
    Apr 2005
    Location
    Finland
    Posts
    314

    Default

    Should the 'url-pattern' be just 'pattern' ?

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <decorators defaultdir="/WEB-INF/decorators">
    
        <decorator name="main" page="main.jsp">
            <pattern>/*</pattern>   
        </decorator> 
        
        <decorator name="private" page="private.jsp">
            <pattern>/*/admin/*</pattern> 
        </decorator>   
       
    </decorators>
    I don't know has the configuration changed in Sitemesh 2.3? But this is how I have configured it in Sitemesh 2.2.x.
    if a trainstation is where the train stops, what's a workstation...

  5. #5

    Default

    hi, problem solved.

    actually can be <pattern> or <url-pattern>. and the sequence in of <decorator> is not important. (it just work fine).

    I had use the wrong value in pattern.

    say my url

    https://localhost:8443/app/admin/user/list.htm

    It should just be admin/* but not /*/admin/* (the "app" is my context root, I use tomcat 6)

    thx !

    kiwi
    ----
    happy hacking !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •