2 Replies Latest reply on Jun 11, 2008 5:49 PM by sergeysmirnov

    Adding stylesheets to page not working

    jbarbeau

      command to add a stylesheet to a page has no affect - I have to use the <a4j:loadStyle> to add a stylesheet. Is this the case or am I just doing this incorrectly?

      ex:
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">




      does not work -
      however
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">

      <a4j:loadStyle src="/css/theme.css"></a4j:loadStyle>
      <a4j:loadStyle src="/css/test.css"/>
      does work - even when I get rid of the skin?? I am trying to get a print-friendly web page & can't because a4j:loadStyle does not have a media attribute. Thanks for any help!

        • 1. Re: Adding stylesheets to page not working
          jbarbeau

          Sorry the first ex should look like this:

          <link rel="stylesheet" type="text/css" href="css/theme.css" />
          <link rel="stylesheet" type="text/css" href="css/test.css" />


          • 2. Re: Adding stylesheets to page not working

            Your first question has no relation with RichFaces. Most likely, you point to the wrong directory trying to use a relative path.

            Usually, adding the content relative prefix helps. If you use JSF 1.2 or Facelets, you can try:

            <link rel="stylesheet" type="text/css" href="#{facesContext.externalContext.requestContextPath}/css/theme.css" />