8 Replies Latest reply on Jun 22, 2011 3:40 AM by amine wannass

    Richfaces : panelMenu

    amine wannass Newbie

      Hi,

       

      I have just started with JSF. I want to create a simple Menu with Richfaces for my application, for that i used this code but it did not work any helpful answers are appreciated.

      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      
      
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      
      
      <!-- RichFaces tag library declaration -->
      
      
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      
      
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      
      
      
      <html>
      
      
      
      
      <head>
      
      
      <title>Accueil Developpeur</title>
      </head>
      
      
      
      
      <h:form id="form">
          <h:panelGrid columns="2"  width="400">
          <rich:panelMenu style="width:200px"  mode="ajax" 
              iconExpandedGroup="disc" iconCollapsedGroup="disc" 
              iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right" 
              iconCollapsedTopGroup="chevronDown">
              <rich:panelMenuGroup label="Group 1">
                 
              </rich:panelMenuGroup>
              <rich:panelMenuGroup label="Group 2">
                 
                  <rich:panelMenuGroup label="Group 2.4">
                      
                  </rich:panelMenuGroup>
                  
              </rich:panelMenuGroup>
              <rich:panelMenuGroup label="Group 3">
                  
            
                  
              </rich:panelMenuGroup>
          </rich:panelMenu>
          <rich:panel bodyClass="rich-laguna-panel-no-header">
              <a4j:outputPanel ajaxRendered="true">
                
              </a4j:outputPanel>
          </rich:panel>
          </h:panelGrid>
          </h:form>
      
      
      
      </html>
      
      
      

       

      This is error :

       

      javax.faces.FacesException: An exception occurred processing JSP page /index.jsp at line 24  
      21: </head> 
      22: 23: 24: <h:form id="form">
       25:     <h:panelGrid columns="2"  width="400">
       26:     <rich:panelMenu style="width:200px"  mode="ajax"
       27:         iconExpandedGroup="disc" iconCollapsedGroup="disc"    
      
      
      
      
      
      
      
        • 1. Re: Richfaces : panelMenu
          Saroj Padhy Novice

          Please provide Richfaces and JSF version you using!

           

          And did you miss body tag!

          • 2. Re: Richfaces : panelMenu
            amine wannass Newbie

            I'm using JSF 1.2 with Richfaces-api-3.2.2.GA.jar and  Richfaces-impl-3.2.2.GA.jar and Richfaces-ui-3.2.2.GA.jar

             

            I added the body and it didnt work

            • 3. Re: Richfaces : panelMenu
              Saroj Padhy Novice

              Can you post complete error log! And the index.jsp file.

              • 4. Re: Richfaces : panelMenu
                amine wannass Newbie

                Error log :

                 

                An exception occurred processing JSP page /index.jsp at line 24 21: </head> 22: 23: 24: <h:form id="form"> 25: <h:panelGrid columns="2" width="400"> 26: <rich:panelMenu style="width:200px" mode="ajax" 27: iconExpandedGroup="disc" iconCollapsedGroup="disc" Stacktrace:

                 

                Caused by:
                java.lang.IllegalArgumentException - Component org.ajax4jsf.component.AjaxViewRoot is no javax.faces.component.html.HtmlForm

                Stack Trace

                javax.faces.FacesException: An exception occurred processing JSP page /index.jsp at line 24

                21: </head> 22: 23: 24: <h:form id="form"> 25:     <h:panelGrid columns="2"  width="400"> 26:

                    <rich:panelMenu style="width:200px"  mode="ajax" 27:      

                  iconExpandedGroup="disc" iconCollapsedGroup="disc" 

                Stacktrace:

                at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:347) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.buildView(JspViewHandlerImpl.java:486) at org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:337) at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108) at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196) at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41) at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:187) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177) at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267) at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380) at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Unknown Source)


                Caused by: org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 24

                21: </head> 22: 23: 24: <h:form id="form"> 25:     <h:panelGrid columns="2"  width="400"> 26:

                    <rich:panelMenu style="width:200px"  mode="ajax" 27:      

                  iconExpandedGroup="disc" iconCollapsedGroup="disc"

                  Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:519) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:410) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302) at org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:341) ... 25 more

                 

                Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.IllegalArgumentException: Component org.ajax4jsf.component.AjaxViewRoot is no javax.faces.component.html.HtmlForm at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:861) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794) at org.apache.jsp.index_jsp._jspService(index_jsp.java:106) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:386) ... 35 more Caused by: java.lang.IllegalArgumentException: Component org.ajax4jsf.component.AjaxViewRoot is no javax.faces.component.html.HtmlForm at org.apache.myfaces.taglib.html.HtmlFormTag.setProperties(HtmlFormTag.java:189) at javax.faces.webapp.UIComponentClassicTagBase.findComponent(UIComponentClassicTagBase.java:1108) at javax.faces.webapp.UIComponentClassicTagBase.doStartTag(UIComponentClassicTagBase.java:514) at org.apache.jsp.index_jsp._jspx_meth_h_005fform_005f0(index_jsp.java:125) at org.apache.jsp.index_jsp._jspService(index_jsp.java:94) ... 38 more

                • 5. Re: Richfaces : panelMenu
                  amine wannass Newbie

                  index.jsp :

                   

                   

                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                  
                  
                  <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
                  
                  
                  <!-- RichFaces tag library declaration -->
                  
                  
                  <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
                  
                  
                  <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
                  
                  
                  
                  <html>
                  
                  
                  
                  
                  <head>
                  
                  
                  <title>Accueil Developpeur</title>
                  </head>
                  <body>
                  
                  
                  
                  
                  <h:form id="form">
                      <h:panelGrid columns="2"  width="400">
                      <rich:panelMenu style="width:200px"  mode="ajax" 
                          iconExpandedGroup="disc" iconCollapsedGroup="disc" 
                          iconExpandedTopGroup="chevronUp" iconGroupTopPosition="right" 
                          iconCollapsedTopGroup="chevronDown">
                          <rich:panelMenuGroup label="Group 1">
                             
                          </rich:panelMenuGroup>
                          <rich:panelMenuGroup label="Group 2">
                             
                              <rich:panelMenuGroup label="Group 2.4">
                                  
                              </rich:panelMenuGroup>
                              
                          </rich:panelMenuGroup>
                          <rich:panelMenuGroup label="Group 3">
                              
                        
                              
                          </rich:panelMenuGroup>
                      </rich:panelMenu>
                      <rich:panel bodyClass="rich-laguna-panel-no-header">
                          <a4j:outputPanel ajaxRendered="true">
                            
                          </a4j:outputPanel>
                      </rich:panel>
                      </h:panelGrid>
                      </h:form>
                  
                  </body>
                  </html>
                  
                  
                  
                  • 6. Re: Richfaces : panelMenu
                    amine wannass Newbie

                    I need any help for i can realy start my application (project end of study)

                     

                    Thanks.

                    • 7. Re: Richfaces : panelMenu
                      Saroj Padhy Novice

                      Add <f:view> to your page.

                       

                      jsp page structure would be like this:

                       

                      <f:view>

                      <html>

                        <head>

                          ...

                        </head>

                        <body>

                          ...

                        </body>

                      </html>

                      </f:view>

                      • 8. Re: Richfaces : panelMenu
                        amine wannass Newbie

                        Thank you Saroj it works