Announcement Announcement Module
Collapse
No announcement yet.
Include CSS or Javascript on pages Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Include CSS or Javascript on pages

    Hi

    How can I include CSS files or scripts in my pages? I tried the 'regular' HTML way:
    Code:
    <link rel="stylesheet" type="text/css"	href="../css/fonts.css"/>
    and it doesn't work. Hoping that the problem was the css file path, I decided to put the fonts.css file in my jsp folder so there was no path errors, but that was not the problem...
    After some searching, I decided to create a theme where I included the CSS. For that I did this:

    My project structure:
    Code:
    +XXXapp
       +sources
           +common
           +customer
           +login
           +permissions
           +sources
       +db
           +customer
           +db
           +login
           +permissions
           +tree
       +web
           +login
           +permissions
           +web
       +css
       +images
       +war
           +WEB-INF
               +classes
               +jsp
                   +scripts
               +lib
    I've created a theme named theme_tree in my xxxapp-servlet.xml
    Code:
    <bean id="themeResolver" class="org.springframework.web.servlet.theme.Cooki eThemeResolver">
    
    <property name="defaultThemeName" value="theme_tree"/>
    
    </bean>
    And I've also created my interceptor :
    Code:
    <bean id="themeChangeInterceptor" class="org.springframework.web.servlet.theme.Theme ChangeInterceptor"/>
    In my jsp i have :
    Code:
    <link rel="stylesheet" href="<spring:theme code="css"/>" type="text/css"/>
    And this didn┤t work either...

    What can be the problem and how can I solve it?

    Thanks in advance
    Rui Gonšalves

  • #2
    Originally posted by pranxas View Post
    Hi

    How can I include CSS files or scripts in my pages? I tried the 'regular' HTML way:
    Code:
    <link rel="stylesheet" type="text/css"    href="../css/fonts.css"/>
    The "regular" way must of course work and has not much to do with spring.
    Is the css in a path that can be accessed?
    Did you try to get the css putting manually the url in your browser?
    /roberto

    Comment


    • #3
      You should map the ''theme_tree" property in the properties file. Do you have property file named that way ?

      Comment

      Working...
      X