6 Replies Latest reply on Dec 12, 2007 1:36 PM by Dmitry Shultz

    RichFaces + Facelets

    Dmitry Shultz Novice

      Hi,

      I created some application using JSF 1.2 and RichFaces, It runs on Glassfish perfectly and works in any browser.
      Something happened when JSP was repaced by Facelets - Drop Down Menu stopped to drop down, Safari crashing when parsing the xhtml... I'm just wandering if it is happening only to me or somebody experiencing similar problems?

      An help is welcome.
      Thanks,
      Dmitry.

        • 1. Re: RichFaces + Facelets
          Florian Marwede Expert

          Hi,

          what did you do exactly when you replaced JSPs by Facelets? Aside from simply replacing the .jsp by .xhtml files you have to do some other things. For example you need something like this in your faces-config:

           <application>
           <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
           </application>
          


          And in web.xml a couple of things have to be adjusted, too.

          • 2. Re: RichFaces + Facelets
            Dmitry Shultz Novice

            I was not clear, sorry..
            Almost everything (include some other RichFaces components) works Ok, something happened only to the Dropping Down Menu Java Script.
            Yes, the ViewHandler is configured.

            • 3. Re: RichFaces + Facelets
              Florian Marwede Expert

              Okay, then the following is interesting: What Safari version you use? I remember a couple of bugs concerning some safari versions. Please search in jira/this forum about this topic.

              And what Richfaces version? Perhaps it is bug already fix and you only have to update...

              Furthermore please post a small code snippet where the error appeared, so we can try to reproduce it.

              • 4. Re: RichFaces + Facelets
                Dmitry Shultz Novice

                Safari 3 (on Leopard) crashing with this:

                Thread 0 Crashed:
                0 com.apple.WebCore 0x95001f94 WebCore::XMLTokenizer::lineNumber() const + 4
                1 com.apple.WebCore 0x94e9cdd0 WebCore::XMLTokenizer::startElementNs(unsigned char const*, unsigned char const*, unsigned char const*, int, unsigned char const**, int, int, unsigned char const**) + 1680
                2 libxml2.2.dylib 0x90694558 xmlIOParseDTD + 6228
                3 libxml2.2.dylib 0x906645c4 xmlParseElement + 144
                4 libxml2.2.dylib 0x906657c4 xmlParseContent + 280
                5 libxml2.2.dylib 0x906965b4 xmlParseBalancedChunkMemoryRecover + 536
                6 com.apple.WebCore 0x95004bfc WebCore::parseXMLDocumentFragment(WebCore::String const&, WebCore::DocumentFragment*, WebCore::Element*) + 204
                

                I'm using facelets-1.1.14 and RichFaces 3.1.2

                Here is the template:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html
                 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:a4j="http://richfaces.org/a4j"
                 xmlns:rich="http://richfaces.org/rich"
                 xmlns:f="http://java.sun.com/jsf/core">
                
                
                <f:view>
                <h:form id="form">
                <body>
                <div id="toolBar">
                <rich:toolBar>
                <rich:toolBarGroup>
                <rich:dropDownMenu value="Drop Down">
                 <rich:menuItem submitMode="ajax" value="Menu Item 2" action="action1"></rich:menuItem>
                 <rich:menuItem submitMode="ajax" value="Menu Item 2" action="action2"></rich:menuItem>
                </rich:dropDownMenu>
                </rich:toolBarGroup>
                </rich:toolBar>
                </div>
                </body>
                </h:form>
                </f:view>
                </html>
                
                


                and the page:

                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets">
                <body>
                
                This text above will not be displayed.
                
                <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" template="/harmony_template.xhtml">
                
                <ui:define name="toolbar">
                <div id="toolBar">
                <rich:toolBar>
                <rich:toolBarGroup>
                <rich:dropDownMenu value="Technology">
                 <rich:menuItem submitMode="ajax" value="Enterprise Technology" action="technology"></rich:menuItem>
                 <rich:menuItem submitMode="ajax" value="Outsoursing" action="outsoursing"></rich:menuItem>
                </rich:dropDownMenu>
                </rich:toolBarGroup>
                </rich:toolBar>
                </div>
                </ui:define>
                </ui:composition>
                </body>
                </html>
                
                



                • 5. Re: RichFaces + Facelets
                  Dmitry Shultz Novice

                   

                  <?xml version="1.0" encoding="UTF-8"?>
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
                  <html xmlns="http://www.w3.org/1999/xhtml">
                  <head><link rel='stylesheet' type='text/css' href='/harmonyfacelets/a4j_3_1_2.GAcss/toolBar.xcss/DATB/eAGLZKr5DAADWQHL.jsf' /><link rel='stylesheet' type='text/css' href='/harmonyfacelets/a4j_3_1_2.GAcss/dropdownmenu.xcss/DATB/eAGLZKr5DAADWQHL.jsf' /><link rel='stylesheet' type='text/css' href='/harmonyfacelets/a4j_3_1_2.GAcss/menucomponents.xcss/DATB/eAGLZKr5DAADWQHL.jsf' /><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAorg.ajax4jsf.javascript.PrototypeScript.jsf'></script><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAorg.ajax4jsf.javascript.AjaxScript.jsf'></script><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAscripts/menu.js.jsf'></script><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/utils.js.jsf'></script><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAorg/ajax4jsf/javascript/scripts/form.js.jsf'></script><script type='text/javascript' src='/harmonyfacelets/a4j_3_1_2.GAorg/richfaces/renderkit/html/scripts/form.js.jsf'></script></head><form id="form" name="form" method="post" action="/harmonyfacelets/home.jsf" enctype="application/x-www-form-urlencoded">
                  <input type="hidden" name="form" value="form" />
                  
                  <head>
                   <meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
                  
                   <title>Facelets + RichFaces</title>
                  
                  
                  </head>
                  
                  
                  <body>
                  <div id="toolBar"><table border="0" cellpadding="0" cellspacing="0" class="dr-toolbar-ext rich-toolbar " id="form:j_id3" width="100%"><tr valign="middle"><td class="dr-toolbar-int rich-toolbar-item "><div class=" dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect" id="form:j_id5" onmouseout="this.className='dr-menu-label dr-menu-label-unselect rich-ddmenu-label rich-ddmenu-label-unselect'; " onmouseover="this.className='dr-menu-label dr-menu-label-select rich-ddmenu-label rich-ddmenu-label-select' ; " style=";"><span class="dr-label-text-decor rich-label-text-decor">Technology</span><div style="margin: 0px; padding: 0px; border: 0px; position: relative; z-index:100;"><div id="form:j_id5_menu" class="dr-menu-list-border rich-menu-list-border" style="visibility: hidden; z-index: 2; "><div class="dr-menu-list-bg rich-menu-list-bg"><div class="dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled " id="form:j_id6" onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled '; ; A4J.AJAX.Submit('_viewRoot','form',event,{'parameters':{'form:j_id6':'form:j_id6'} ,'actionUrl':'/harmonyfacelets/home.jsf'} )" onmouseout="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled '; $('form:j_id6:icon').className='dr-menu-icon rich-menu-item-icon '; $('form:j_id6:anchor').className='rich-menu-item-label';" onmouseover="this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover '; $('form:j_id6:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected '; $('form:j_id6:anchor').className='rich-menu-item-label rich-menu-item-label-selected';"><span class="dr-menu-icon rich-menu-item-icon " id="form:j_id6:icon"><img height="16" src="/harmonyfacelets/a4j_3_1_2.GAimages/spacer.gif.jsf" width="16" /></span><span class="rich-menu-item-label" id="form:j_id6:anchor">Enterprise Technology</span></div><div class="dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled " id="form:j_id7" onclick="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled '; ; A4J.AJAX.Submit('_viewRoot','form',event,{'parameters':{'form:j_id7':'form:j_id7'} ,'actionUrl':'/harmonyfacelets/home.jsf'} )" onmouseout="this.className='dr-menu-item dr-menu-item-enabled rich-menu-item rich-menu-item-enabled '; $('form:j_id7:icon').className='dr-menu-icon rich-menu-item-icon '; $('form:j_id7:anchor').className='rich-menu-item-label';" onmouseover="this.className='dr-menu-item dr-menu-item-hover rich-menu-item rich-menu-item-hover '; $('form:j_id7:icon').className='dr-menu-icon dr-menu-icon-selected rich-menu-item-icon rich-menu-item-icon-selected '; $('form:j_id7:anchor').className='rich-menu-item-label rich-menu-item-label-selected';"><span class="dr-menu-icon rich-menu-item-icon " id="form:j_id7:icon"><img height="16" src="/harmonyfacelets/a4j_3_1_2.GAimages/spacer.gif.jsf" width="16" /></span><span class="rich-menu-item-label" id="form:j_id7:anchor">Outsoursing</span></div><div class="dr-menu-list-strut rich-menu-list-strut"><img width="1" height="1" alt="" border="0" style="" src="/harmonyfacelets/a4j_3_1_2.GAorg/richfaces/renderkit/html/images/spacer.gif.jsf" /></div></div></div><iframe src="/harmonyfacelets/a4j_3_1_2.GAorg/richfaces/renderkit/html/images/spacer.gif.jsf" id="form:j_id5_menu_iframe" class="underneath_iframe" style="position:absolute; z-index: 1;"></iframe><script id="form:j_id5_menu_script" type="text/javascript">
                  //<![CDATA[
                  new RichFaces.Menu.Layer('form:j_id5_menu',50,800).asDropDown('form:j_id5','onmouseover','onmouseout',{'jointPoint':'auto','onitemselect':'','direction':'auto','horizontalOffset':0,'ongroupactivate':'','verticalOffset':0,'oncollapse':'','onexpand':''} ).addItem('form:j_id6',1,{'flagGroup':0} ).addItem('form:j_id7',1,{'flagGroup':0} );
                  //]]>
                  </script></div></div></td><td width="100%"></td></tr></table>
                  </div>
                  <div id="content">
                  </div>
                  </body><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="_id1" />
                  </form>
                  </html>
                  
                  


                  • 6. Re: RichFaces + Facelets
                    Dmitry Shultz Novice

                    The last on is a result page shown in browser, it's not exact output of this particular template and composition, but very similar.
                    (probably it wasn't very good idea to put like this ...)