10 Replies Latest reply on Mar 23, 2007 5:24 AM by Per Jansson

    ModalPanel is undefined

    Per Jansson Newbie

      This is a real newbie question. I probably have not set up my webapp correctly and I hope to get help. I try to use modalPanel but get this javascript error when page is loaded:

      'ModalPanel' is undefined

      It happens on this script line:

      new ModalPanel('panel',
      {
      width: 300,
      height: 200,

      minWidth: -1,
      minHeight: -1,

      resizeable: true,
      moveable: true,

      left: "auto",
      top: "auto",

      zindex: 100
      });

      What am I doing wrong?

      Regards

      Pichdude

        • 2. Re: ModalPanel is undefined
          Per Jansson Newbie

          Yes, I have seen it and it works for me. However, what I did not mention, is that I am trying to put RichFaces ModalPanel to work in my existing web app that also has:

          MyFaces 1.2
          Tomahawk 1.5
          Tiles 2.0
          Shale 1.1

          Is it possible that any of these do not work along with RichFaces?

          • 3. Re: ModalPanel is undefined
            Sergey Smirnov Master

            Most likely, it means when page is loaded, it does not come thought the Ajax4jsf filter.
            So, the content of the web.xml is a subject for investigation.

            • 4. Re: ModalPanel is undefined
              Per Jansson Newbie

              This is the main part of my web.xml:

              <?xml version="1.0" encoding="UTF-8"?>
              <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
               <display-name>PrototypeWeb</display-name>
               <context-param>
               <description>JSF configuraton files</description>
               <param-name>javax.faces.CONFIG_FILES</param-name>
               <param-value>/WEB-INF/config/transfer/transfer-faces-config.xml</param-value>
               </context-param>
               <context-param>
               <description>Saves view state between requests on server</description>
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>server</param-value>
               </context-param>
               <context-param>
               <description>Tells MyFaces if javascript code should be allowed in the rendered HTML output</description>
               <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
               <param-value>true</param-value>
               </context-param>
               <context-param>
               <description>Rendered HTML code will be formatted, so that it is "human readable".</description>
               <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
               <param-value>true</param-value>
               </context-param>
               <context-param>
               <description>Validates JSF configuration files on startup</description>
               <param-name>org.apache.myfaces.validate</param-name>
               <param-value>true</param-value>
               </context-param>
               <context-param>
               <param-name>org.ajax4jsf.SKIN</param-name>
               <param-value>classic</param-value>
               </context-param>
               <context-param>
               <description>Shale configuration</description>
               <param-name>org.apache.shale.dialog.basic.CONFIGURATION</param-name>
               <param-value>...</param-value>
               </context-param>
               <context-param>
               <description>Configures strategy for storing dialog state information across requests</description>
               <param-name>org.apache.shale.dialog.basic.STRATEGY</param-name>
               <param-value>stack</param-value>
               </context-param>
               <context-param>
               <description>Tiles configuration</description>
               <param-name>tiles-definitions</param-name>
               <param-value>...</param-value>
               </context-param>
               <context-param>
               <description>Validation rules</description>
               <param-name>validation_xml</param-name>
               <param-value>...</param-value>
               </context-param>
               <context-param>
               <description>Spring configuration files</description>
               <param-name>contextConfigLocation</param-name>
               <param-value>...</param-value>
               </context-param>
               <filter>
               <description>Shale Filter</description>
               <filter-name>Shale</filter-name>
               <filter-class>org.apache.shale.application.faces.ShaleApplicationFilter</filter-class>
               </filter>
               <filter>
               <description>Configuration for resources (scripts, style sheets, images) needed by some Tomahawk components</description>
               <filter-name>MyFacesExtensionsFilter</filter-name>
               <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
               </filter>
               <filter>
               <display-name>Ajax4jsf Filter</display-name>
               <filter-name>ajax4jsf</filter-name>
               <filter-class>org.ajax4jsf.Filter</filter-class>
               </filter>
               <filter-mapping>
               <filter-name>Shale</filter-name>
               <url-pattern>/*</url-pattern>
               </filter-mapping>
               <filter-mapping>
               <filter-name>MyFacesExtensionsFilter</filter-name>
               <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
               </filter-mapping>
               <filter-mapping>
               <filter-name>MyFacesExtensionsFilter</filter-name>
               <url-pattern>*.faces</url-pattern>
               </filter-mapping>
               <filter-mapping>
               <filter-name>ajax4jsf</filter-name>
               <servlet-name>FacesServlet</servlet-name>
               < dispatcher>FORWARD</ dispatcher>
               < dispatcher>REQUEST</ dispatcher>
               < dispatcher>INCLUDE</ dispatcher>
               </filter-mapping>
               <!-- Listeners -->
               <listener>
               <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
               </listener>
               <listener>
               <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
               </listener>
               <!-- Servlets -->
               <servlet>
               <servlet-name>FacesServlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
               <servlet-mapping>
               <servlet-name>FacesServlet</servlet-name>
               <url-pattern>*.faces</url-pattern>
               </servlet-mapping>
               <welcome-file-list>
               <welcome-file>index.jsp</welcome-file>
               </welcome-file-list>
               <login-config>
               <auth-method>BASIC</auth-method>
               </login-config>
              </web-app>
              


              • 5. Re: ModalPanel is undefined
                Per Jansson Newbie

                Still no luck, at first I thought this was the problem, but unfortunately it was not:

                http://labs.jboss.com/file-access/default/members/jbossajax4jsf/freezone/docs/devguide/ApacheMyFaces.html

                • 6. Re: ModalPanel is undefined
                  Sergey Smirnov Master

                  Ajax4jsf should be the first filter declared in the web.xml

                  • 7. Re: ModalPanel is undefined
                    Per Jansson Newbie

                    Yes I know, as I sad in my last post that was not the problem.

                    • 8. Re: ModalPanel is undefined
                      Sergey Smirnov Master

                      Something about Shale here:
                      http://www.jboss.com/index.html?module=bb&op=viewtopic&t=103582

                      Also, you have different filter mapping for different framework. So, it is still possible, the page does not come thru the Ajax4jsf filter

                      • 9. Re: ModalPanel is undefined
                        Per Jansson Newbie

                        Yes, thanks a lot. I been runnit on Shale 1.1 and that seems to be the problem.

                        • 10. Re: ModalPanel is undefined
                          Per Jansson Newbie

                          I now have a working example of ajax4jsf with <a4j:support>. But I cannot get RichFaces to work, with this example:


                          <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
                          <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
                          <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
                          <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
                          
                          <f:view>
                          
                           <rich:modalPanel id="panel" rendered="true">
                          
                           <f:verbatim>Hello world!</f:verbatim>
                          
                           </rich:modalPanel>
                          
                          
                          
                           <f:verbatim><a href="javascript:RichFaces.showModalPanel('panel')">Show</a></f:verbatim>
                          
                          </f:view>
                          


                          I receive a javascript error message: 'RichFaces' is undefined. So i guess something in my settings is wrong.

                          I have changed filter declarations to this:

                           <filter>
                           <display-name>Ajax4jsf Filter</display-name>
                           <filter-name>ajax4jsf</filter-name>
                           <filter-class>org.ajax4jsf.Filter</filter-class>
                           </filter>
                           <filter-mapping>
                           <filter-name>ajax4jsf</filter-name>
                           <servlet-name>FacesServlet</servlet-name>
                           <dispatcher>FORWARD</dispatcher>
                           <dispatcher>REQUEST</dispatcher>
                           <dispatcher>INCLUDE</dispatcher>
                           </filter-mapping>
                          
                           <filter>
                           <description>Shale Filter</description>
                           <filter-name>Shale</filter-name>
                           <filter-class>org.apache.shale.faces.ShaleApplicationFilter</filter-class>
                           </filter>
                           <filter-mapping>
                           <filter-name>Shale</filter-name>
                           <url-pattern>*.faces</url-pattern>
                           </filter-mapping>
                          
                           <filter>
                           <description>Configuration for resources (scripts, style sheets, images) needed by some Tomahawk components</description>
                           <filter-name>MyFacesExtensionsFilter</filter-name>
                           <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
                           </filter>
                           <filter-mapping>
                           <filter-name>MyFacesExtensionsFilter</filter-name>
                           <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                           </filter-mapping>
                           <filter-mapping>
                           <filter-name>MyFacesExtensionsFilter</filter-name>
                           <url-pattern>*.faces</url-pattern>
                           </filter-mapping>
                          


                          I use:
                          ajax4jsf-1.1.0
                          richfaces-3.0.0
                          oscache-2.3