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

  • Themes

    What are themes? Are they supposed to implement something like sitemesh? Are they currently working?

  • #2
    yep.

    here's what seems to be the minimum to get them going, based on my slightly hit and miss approach.

    1. setup handlerMapping, themeInterceptor and themeResolver in *-servlet.xml

    Code:
    <bean id="handlerMapping"   class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping">
        <property name="interceptors">
          <list>
            <ref local="themeChangeInterceptor"/>
          </list>
        </property>
      </bean>
    
    <bean id="themeResolver" class="org.springframework.web.servlet.theme.SessionThemeResolver"/>
    
    <bean id="themeChangeInterceptor" class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"/>
    2. setup messageSource to determine at a minimum any themes you have. In this case, 'dev' and 'theme' are themes. 'theme' seems to be the default theme name.

    Code:
    <bean id="messageSource"
          class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basenames">
          <list>
            <value>WEB-INF/usermessages</value>
            <value>WEB-INF/dbmessages</value>
            <value>WEB-INF/label</value>
            <value>WEB-INF/dev</value>
            <value>WEB-INF/theme</value>
          </list>
        </property>
      </bean>
    3. create properties files referenced in messageResource, e.g. classes/dev.properties. The 'css' property in this file will be used to construct a link reference in your JSP page.

    Code:
    css=/themes/dev/style.css
    4. plug theme/CSS resolving into your JSP

    Code:
    <c&#58;set var="css"><spring&#58;theme code="css"/></c&#58;set>
        <c&#58;if test="$&#123;not empty css&#125;">
          <link rel="stylesheet" href="<c&#58;url value='$&#123;css&#125;'/>" type="text/css" />
        </c&#58;if>
    5. put buttons or whatever on jsp page to switch themes, where dev and theme below seem to correspond to the property files referenced in step 2.

    Code:
    <input type="submit" name="theme" value="dev"/>
    <input type="submit" name="theme" value="theme"/>

    Comment


    • #3
      Hopefully the documentation will talk about this soon. "Dummy Paragraph" does not do much good.

      Comment


      • #4
        I think sitemesh and themes are completely different things. Themes allow you to include in a web page "theme" specific stuff (for example, you could have several different gif files for a logo, a different gif for each "theme").

        sitemesh, on the other hand, extracts sections of html out of a source web page and embeds that html in another page. This allows you to build wrappers, or "decorators" for basic content-only oriented web pages (which may contain "theme" specific data).

        Comment


        • #5
          I agree. I'm not even sure about the images. It may be just a way to associate a stylesheet with a user.

          Comment


          • #6
            I found the same lack of documentation issue and if I didn't find this post I would still be up a creek without a paddle. Thanks for the most excellent post.
            Cheers.

            Comment


            • #7
              any help on using themes with velocity? can't find anything on that topic

              thanks for any advice
              Tomek

              Comment

              Working...
              X