Announcement Announcement Module
Collapse
No announcement yet.
sitemesh configuration in spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • sitemesh configuration in spring

    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, 10:38 AM. Reason: problem solved.

  • #2
    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).

    Comment


    • #3
      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, 06:51 AM.

      Comment


      • #4
        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.

        Comment


        • #5
          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 !

          Comment

          Working...
          X