7 Replies Latest reply on Sep 11, 2013 3:16 PM by bleathem

    rich:placeholder doesn't display correctly

    strannik

      Hi

       

      Rich:placeholder shows its prompt text with black color in my application.

      It turned out that the related style are not used in the browser.

       

      input.rf-plhdr, textarea.rf-plhdr {

       

       

          color: #777777;

       

      }

       

      Further investigation showed that css files are loaded in the wrong order and in the h:body.

       

      <link href="/test/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.3.3.Final/PackedCompressed/packed/packed.css" rel="stylesheet" type="text/css">

      <link href="/test/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.3.3.Final/PackedCompressed/classic/skinning.css" rel="stylesheet" type="text/css">

       

      In ShowCase example, the skinning.css are followed by packed.css and located in h:head

       

      <link href="/richfaces-showcase-tomcat6/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.3.3.Final/Packed/blueSky/skinning.css" rel="stylesheet" type="text/css">

      <link href="/richfaces-showcase-tomcat6/org.richfaces.resources/javax.faces.resource/org.richfaces.staticResource/4.3.3.Final/Packed/packed/packed.css" rel="stylesheet" type="text/css">

       

      Is it possible somehow to fix that?

        • 1. Re: rich:placeholder doesn't display correctly
          bleathem

          This is (unfortunately) a well know problem with JSF resource loading.  Put your h:outputStylesheet component for your custom CSS page as the very last component on your page.  This way your CSS sheet is guranteed to be loaded last, and override the stylesheet resources requested by the JSF components.

          1 of 1 people found this helpful
          • 2. Re: rich:placeholder doesn't display correctly
            strannik

            Thank you, Brian.

             

            I already did that. However it's strange to me that resources are loaded in a such way.

            Can you please explain why it happens? This is pure RichFaces resources, not custom, so I am curious about that.

            • 3. Re: rich:placeholder doesn't display correctly
              bleathem

              I'm sorry, I mis-read your original post.  It's weird that the css files are served in the wrong order.  Can you post a facelet file we can use to reproduce the problem?

               

              Also, what implementation * version of JSF are you using?  And what version of RichFaces?

              • 4. Re: rich:placeholder doesn't display correctly
                strannik

                I'm using JSF 2.1.25 and RichFaces 4.3.3

                 

                Here facelet file.

                 

                <html xmlns="http://www.w3.org/1999/xhtml"
                    xmlns:ui="http://java.sun.com/jsf/facelets"
                    xmlns:f="http://java.sun.com/jsf/core"
                    xmlns:h="http://java.sun.com/jsf/html"
                    xmlns:rich="http://richfaces.org/rich"
                    xmlns:a4j="http://richfaces.org/a4j"
                    xmlns:layout="http://richfaces.org/sandbox/layout"
                    xmlns:sf="http://www.springframework.org/tags/faces">
                <f:view contentType="text/html" encoding="UTF-8"
                    locale="#{userLocale.locale}" viewId="mainView">
                    <a4j:outputPanel id="mainPanel">
                        <h:head>
                            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                            <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
                            <sf:includeStyles />
                            <sf:resourceGroup>
                                <sf:resource path="/css-framework/css/tools.css" />
                                <sf:resource path="/css-framework/css/typo.css" />
                                <sf:resource path="/css-framework/css/forms.css" />
                                <sf:resource path="/css-framework/css/layout-navtop-localleft.css" />
                                <sf:resource path="/css-framework/css/layout.css" />
                            </sf:resourceGroup>
                            <ui:insert name="headIncludes" />
                        </h:head>
                        <h:body styleClass="tundra">
                                        <ui:insert name="content" />
                        </h:body>
                    </a4j:outputPanel>
                </f:view>
                </html>
                
                • 5. Re: rich:placeholder doesn't display correctly
                  bleathem

                  The first component you call is an <a4j:outputPanel>, so the first stylesheet requested maps to the packed.css file.  Try nesting that a4j:panel deeper in your DOM, and see if that works-areound the problem.

                   

                  Please file a bug report for this issue including the above facelet sample file.

                  1 of 1 people found this helpful
                  • 6. Re: rich:placeholder doesn't display correctly
                    strannik

                    I removed the a4j:outputPanel completely. But unfortunately the .css files are still loaded in the wrong order.

                    • 7. Re: rich:placeholder doesn't display correctly
                      bleathem

                      This is surprising, as the skinning resources are added to the the view when the view is initially built, see:

                      https://github.com/richfaces4/core/blob/master/impl/src/main/java/org/richfaces/application/GlobalResourcesViewHandler.java#L158

                       

                      Are you using Mojarra or MyFaces?  Can you try selectively removing libraries from your project to see if we can identify one of them as causing this behaviour?  Perhaps the sandbox layout component, or the spring resource tags.

                       

                      If we can isolate which library is causing this behaviour in RichFaces, we can more effectively seek a resolution.