Discussions

News: SiteMesh: Learning all of the features of SiteMesh

  1. SiteMesh: Learning all of the features of SiteMesh (15 messages)

    SiteMesh is a web-page layout and decoration framework which competes with packages such as Struts-Tiles, and hand coding :) SiteMesh is one of those applications that many people always carry in their toolbox, yet isn't talked about much. Advanced SiteMesh delves into a case study of using the framework.

    Read: Advanced SiteMesh

    Visit: SiteMesh's home page

    Threaded Messages (15)

  2. sitemesh competes with tiles? that's a new one...
  3. sitemesh competes with tiles? that's a new one...
    And pretty successfully in many cases!

    SiteMesh is really wonderful piece of software.

    Couple detail to watch out:
    - when used with Struts and do prefixed mapping like /do/yourAction, and you need more than one path based mappers consider this bug and a workaround: http://jira.opensymphony.com/browse/SIM-127
    - if a common element (menu for instance) is a .jsp and has dynamic elements (like counter) and you display static html page, then in Tomcat you will get page from browser cache because TomcatÂ’s default html file handler sends back not-changed code and browser uses cache. As a workaround simple NonCachingHtmlHandler can be used:
    <servlet>
          <servlet-name>html</servlet-name>
           <servlet-class>xxx.NoCacheHTMLServlet</servlet-class>
    </servlet>
     <servlet-mapping>
            <servlet-name>html</servlet-name>
            <url-pattern>*.html</url-pattern>
    </servlet-mapping>
  4. Hi, I'm new to SiteMesh. Let's say a piece (comming from another web-server/application) of the decorated page contains a link which is relative to it's original context. Can be handled with SiteMesh?
  5. JSP 2.0[ Go to top ]

    How would sitemesh compare to using JSP tag files for headers, footers, etc.?
  6. JSP 2.0[ Go to top ]

    How would sitemesh compare to using JSP tag files for headers, footers, etc.?
    Simply eliminates need for those tags.
  7. JSP 2.0[ Go to top ]

    How would sitemesh compare to using JSP tag files for headers, footers, etc.?
    Rather than having to hard-code in the headers and footers to include, with Sitemesh you declaratively tell it which decorators to apply without the page being decorated having to know anything about it. Thus it can decorate static pages, CGI, PHP, etc. in addition to Servlet and JSP output.
  8. JSP 2.0[ Go to top ]

    Thus it can decorate static pages, CGI, PHP, etc. in addition to Servlet and JSP output.
    Yeah, but tell me who does run servlet engine in front of a web server eg. apache. Usually it's the other way around.
  9. re: JSP 2.0[ Go to top ]

    You don't need to run servlet engine in front of web server.
    You did not understand the idea.
  10. re: JSP 2.0[ Go to top ]

    You don't need to run servlet engine in front of web server.You did not understand the idea.
    I think I did. Propably you didn't. SiteMesh is written using Servlet Filters. Can you please tell me how can you decorate anything without Servlet Engine? If I have for example Apache and mod_php and I have this web server running in front of servlet engine, how I can then decorate my PHP pages (that are generated on web server with mod_php)? That just doesn't work, period. Propably I could run some java code through CGI to emulate filters, but don't say that this is the idea. And yes, I have used SiteMesh and I have even used it in servlet engine that was running behinf a webserver.
  11. re: JSP 2.0[ Go to top ]

    You don't need to run servlet engine in front of web server.You did not understand the idea.
    I think I did. Propably you didn't. SiteMesh is written using Servlet Filters. Can you please tell me how can you decorate anything without Servlet Engine? If I have for example Apache and mod_php and I have this web server running in front of servlet engine, how I can then decorate my PHP pages (that are generated on web server with mod_php)? That just doesn't work, period. Propably I could run some java code through CGI to emulate filters, but don't say that this is the idea. And yes, I have used SiteMesh and I have even used it in servlet engine that was running behinf a webserver.
    I would say that you can use sitemesh in the scenario you are talking about by configuring the front http server to forward all the requests to the 'sitemeshed' servlet engine (and not to dispatch the php requesst directly to the mod_php), and than sitemesh will decorate the output of the php page with whatever you have set up in the decorators.xml ... It is just a supposition, I don't know how if it is practically possible since the php requests should finally processed by modphp which would mean that you are going back to the front http server or that the php app is installed on another http server (e.g. the same machine on another port). I don't know, it sounds weird but I think I could do that.

    In the sitemesh vs tiles comparison ... I think there can't be any comparison. Tiles is a usual piece of software with all limitations imposed by usual design and Sitemesh is a wonder of thechnology with all 'problems' imposed by revolutionary design :-). Meaning it allows you to do too much with it and that is allwais a danger. (One guy said once that the power of a framework stands in what it DOESN'T alow you to do :-))
  12. re: JSP 2.0[ Go to top ]

    I don't know how if it is practically possible since the php requests should finally processed by modphp which would mean that you are going back to the front http server or that the php app is installed on another http server (e.g. the same machine on another port). I don't know, it sounds weird but I think I could do that.
    Yes, my point is that is not practical. SiteMesh developers/users seem to emphatize that you can use SiteMesh with another server side technologies, but they do not say how to do it or if it's practical or not. In my opinion it's not practical to use SiteMesh with other technologies than Java.

    I was in a need for sitemesh like decorating system for my PHP pages. What I did, I first checked out PHP implementation of SiteMesh, but I was not all that happy with it. I decided to write my own and it turned out to be 50 lines of PHP code, with every important feature implemented that are in SiteMesh. I mainly just used PHP's output buffering and regular expressions.
  13. PHP version of SiteMesh[ Go to top ]

    Hi Aapo, Are you looking to release your PHP implementation of SiteMesh? Matt.
  14. re: JSP 2.0[ Go to top ]

    Heres a a way of doing it ;)

    PHP and Tomcat - Perfect bed-fellows?
  15. re: JSP 2.0[ Go to top ]

    Heres a a way of doing it ;) PHP and Tomcat - Perfect bed-fellows?
    PHP's Servlet Wrapper is pure shit compared to mod_php and Apache integration. So, your suggestion is possible, but not very practical.
  16. I would think that Sitemesh and Tiles will compete more and more with Portal frameworks and the JSR-168 and WSRP specs. In essence the specs decouple look and fell and layout from function.