1 Reply Latest reply on Aug 21, 2011 10:40 AM by Ilya Shaikovsky

    JS error using richfaces

    Fabio Paiva Newbie

      Hi all..

       

      I´m using richfaces with jsf 1.2 running in jboss , and i´m getting the js error message:

       

      Webpage error details

       

      User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C)

       

      Timestamp: Sat, 20 Aug 2011 22:17:38 UTC

       

      Message: 'RichFaces' is undefined

       

      Line: 40

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      Message: 'RichFaces' is undefined

       

      Line: 42

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      Message: 'RichFaces' is undefined

       

      Line: 44

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      Message: 'Richfaces' is undefined

       

      Line: 61

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      Message: 'Calendar' is undefined

       

      Line: 65

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      Message: 'A4J' is undefined

       

      Line: 90

       

      Char: 1

       

      Code: 0

       

      URI: http://localhost:8080/EQ2-WEB/eq2/login/bemvindo.html

       

      This is my web.xml:

       

       

      --------------

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <web-app id="EQId" 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>EQ2-WEB</display-name>

       

       

       

          <session-config>

       

            <session-timeout>30</session-timeout>

       

          </session-config>

       

       

       

          <!-- Richfaces config -->

       

          <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>Faces Servlet</servlet-name>

       

              <dispatcher>REQUEST</dispatcher>

       

              <dispatcher>FORWARD</dispatcher>

       

              <dispatcher>INCLUDE</dispatcher>

       

          </filter-mapping>

       

       

       

          <context-param>

       

              <param-name>javax.faces.DEFAULT_SUFFIX</param-name>

       

              <param-value>.xhtml</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>com.sun.faces.verifyObjects</param-name>

       

              <param-value>true</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.richfaces.SKIN</param-name>

       

              <param-value>blueSky</param-value>

       

          </context-param>

       

          <context-param>

       

              <description>If true, rendered HTML code will be formatted, so that

       

                              it is "human readable". i.e. additional line separators and

       

                              whitespace will be written, that do not influence the HTML code.

       

                              Default: "true"

       

                  </description>

       

              <param-name>org.apache.myfaces.PRETTY_HTML</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>

       

              <param-value>true</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.READONLY_AS_DISABLED_FOR_SELECTS</param-name>

       

              <param-value>true</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>facelets.BUILD_BEFORE_RESTORE</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>facelets.RECREATE_VALUE_EXPRESSION_ON_BUILD_BEFORE_RESTORE</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.ADD_RESOURCE_CLASS</param-name>

       

              <param-value>org.apache.myfaces.renderkit.html.util.DefaultAddResource</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>

       

              <param-value>true</param-value>

       

          </context-param>

       

          <context-param>

       

              <description>This parameter tells MyFaces if javascript code

       

                              should be allowed in the rendered HTML output. If javascript is

       

                              allowed, command_link anchors will have javascript code that submits

       

                              the corresponding form. If javascript is not allowed, the state

       

                              saving info and nested parameters will be added as url parameters.

       

                              Default: "false" Setting this param to true should be combined with

       

                              STATE_SAVING_METHOD "server" for best results. This is an

       

                              EXPERIMENTAL feature. You also have to enable the detector

       

                              filter/filter mapping below to get JavaScript detection working.

       

                  </description>

       

              <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

       

       

      <!--        <description> State saving method: "client" or "server" (= default)-->

       

      <!--        See JSF Specification 2.5.2 </description> Vide-->

       

      <!--        http://forum.java.sun.com/thread.jspa?threadID=732063&messageID=4211657-->

       

      <!--        http://www.jroller.com/page/mert?entry=state_saving_method_client_side-->

       

      <!--        Em producao, deve-se utilizar "server", em desenvolvimento "client"-->

       

      <!--        Nao conseguimos fazer esta configuracao via programacao.-->

       

       

       

          <context-param>

       

              <param-name>javax.faces.STATE_SAVING_METHOD</param-name>

       

              <param-value>server</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>

       

              <param-value>/faces/myFacesExtensionResource</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>

       

              <param-value>false</param-value>

       

          </context-param>

       

          <!-- if you are using myfaces + facelets don't forget to do this -->

       

          <context-param>

       

              <param-name>facelets.DEVELOPMENT</param-name>

       

              <param-value>false</param-value>

       

          </context-param>       

       

          <context-param>

       

              <param-name>org.richfaces.LoadScriptStrategy</param-name>

       

              <param-value>ALL</param-value>

       

          </context-param>

       

          <context-param>

       

              <param-name>org.richfaces.LoadStyleStrategy</param-name>

       

              <param-value>ALL</param-value>

       

          </context-param>

       

       

       

          <!-- Configuracao SPRING -->

       

      <!--    <context-param>-->

       

      <!--        <param-name>contextConfigLocation</param-name>-->

       

      <!--        <param-value>/WEB-INF/applicationContext.xml</param-value>-->

       

      <!--    </context-param>-->

       

      <!---->

       

      <!--    <listener>-->

       

      <!--        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>-->

       

      <!--    </listener>-->

       

      <!---->

       

      <!--    <filter>-->

       

      <!--        <filter-name>OpenSessionFilter</filter-name>-->

       

      <!--        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>-->

       

      <!--        <init-param>-->

       

      <!--            <param-name>singleSession</param-name>-->

       

      <!--            <param-value>false</param-value>-->

       

      <!--        </init-param>-->

       

      <!--        <init-param>-->

       

      <!--            <param-name>flushMode</param-name>-->

       

      <!--            <param-value>AUTO</param-value>-->

       

      <!--        </init-param>-->

       

      <!--    </filter>-->

       

      <!--    <filter-mapping>-->

       

      <!--        <filter-name>OpenSessionFilter</filter-name>-->

       

      <!--        <url-pattern>*.html</url-pattern>-->

       

      <!--    </filter-mapping>-->

       

          <!-- Fim Configurcao SPRING -->

       

       

       

          <servlet>

       

              <servlet-name>initEQ2</servlet-name>

       

              <servlet-class>br.gov.caar.eq2.util.init.InitEQ2</servlet-class>

       

              <load-on-startup>1</load-on-startup>

       

          </servlet>

       

       

       

           <filter>

       

              <filter-name>HibernateFilter</filter-name>

       

              <filter-class>br.gov.caar.eq2.web.filter.HibernateSessionRequestFilter</filter-class>

       

          </filter>

       

          <filter-mapping>

       

              <filter-name>HibernateFilter</filter-name>

       

              <url-pattern>/eq2/*</url-pattern>

       

          </filter-mapping>

       

       

       

          <!-- Faces Servlet -->

       

          <servlet>

       

              <servlet-name>Faces Servlet</servlet-name>

       

              <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

       

              <load-on-startup>1</load-on-startup>

       

          </servlet>

       

          <!--

       

              SERVLETS-MAPPINGS envia para faces tudo que for *.html (camuflando a

       

              tecnologia utilizada)

       

          -->

       

          <servlet-mapping>

       

              <servlet-name>Faces Servlet</servlet-name>

       

              <url-pattern>*.html</url-pattern>

       

          </servlet-mapping>

       

          <welcome-file-list>

       

              <welcome-file>/index.jsp</welcome-file>

       

          </welcome-file-list>

       

          <error-page>

       

              <error-code>500</error-code>

       

              <location>/erro.jsp</location>

       

          </error-page>

       

       

       

          <!-- Módulo de Autenticação -->

       

          <security-constraint>

       

              <web-resource-collection>   

       

                  <web-resource-name>acesso</web-resource-name>       

       

                  <url-pattern>*.html</url-pattern>

       

                  <url-pattern>*.xhtml</url-pattern>

       

                  <url-pattern>*.jsp</url-pattern>

       

                  <http-method>POST</http-method>

       

                  <http-method>GET</http-method>

       

              </web-resource-collection>

       

              <auth-constraint>

       

                  <role-name>usuario</role-name>

       

              </auth-constraint>

       

          </security-constraint>

       

          <login-config>

       

              <auth-method>FORM</auth-method>

       

              <form-login-config>

       

                  <form-login-page>/login.jsp</form-login-page>

       

                  <form-error-page>/loginErro.jsp</form-error-page>

       

              </form-login-config>

       

          </login-config>

       

       

       

          <security-role> 

       

              <description>Perfil Usuario</description> 

       

              <role-name>usuario</role-name> 

       

          </security-role> 

       

       

       

          <security-role> 

       

              <description>Perfil secretaria tesouro nacional</description> 

       

              <role-name>STN</role-name> 

       

          </security-role> 

       

      </web-app>

       

      --------------

       

      this is my template:

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <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:rich="http://richfaces.org/rich"

       

              xmlns:a4j="http://richfaces.org/a4j"

       

              xmlns:f="http://java.sun.com/jsf/core">

       

       

       

      <f:view>

       

      <head>

       

          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

       

          <meta http-equiv="Content-Style-Type" content="text/css" />

       

          <meta name="keywords" content="CAAR" />

       

          <meta name="description" content="CAAR" />

       

          <title>CAAR EQ2-WEB ~&#160;<ui:insert name="titulo"/></title>

       

       

       

       

       

          <link rel="stylesheet" href="/esteq2-web/css/reset.css" type="text/css"/>

       

          <link rel="stylesheet" href="/esteq2-web/css/estrutura.css" type="text/css"/>

       

          <link rel="stylesheet" href="/esteq2-web/css/formato.css" type="text/css"/>

       

          <link rel="stylesheet" href="/esteq2-web/css/tabela.css" type="text/css"/>

       

          <link rel="stylesheet" href="/esteq2-web/css/form.css" type="text/css"/>

       

          <!--[if IE 8]>

       

          <link rel="stylesheet" href="/esteq2-web/css/menu_IE8.css" type="text/css"/>

       

          <![endif]-->

       

      </head>

       

      <body>

       

      <div id="ie6ctr">

       

          <div id="outer">

       

              <div class="topo_img">

       

                 <div class="logo_CAAR"><img src="/../esteq2-web/images/geral/img_topo.jpg" class="img_logo_CAAR" alt="caar"/></div>

       

       

       

              </div>

       

       

       

              <noscript>

       

                  <div id="nojavascript">O Javascript está desabilitado no seu browser, o sistema não funcionará adequadamente.</div>

       

              </noscript>

       

       

       

              <rich:modalPanel rendered="#{!empty facesContext.maximumSeverity}">

       

                  <div id="messages">

       

                      <h:messages id="mensagensAplicacao" errorClass="errorMessage" infoClass="infoMessage" fatalClass="fatalMessage" warnClass="warnMessage" layout="list" showDetail="false" showSummary="true"/>

       

                  </div>       

       

                  <rich:jQuery selector="#messages" query="overlayMessage()" timing="onload" />               

       

              </rich:modalPanel>

       

       

       

       

       

       

       

              <div class="esquerdo">

       

                  <ui:insert name="menu">

       

                      <ui:include src="/comum/menu.xhtml"/>

       

                  </ui:insert>

       

              </div> <!--esquerdo-->

       

              <div class="conteudo">

       

                 <div id="image" align="right"  style="margin-top:-15px;position: absolute;left : -14px; width : 92%;">

       

                  <a href="javascript:showOverlayMessage()">               

       

                      <h:graphicImage value="/../esteq2-web/images/geral/warning.gif" rendered="#{!empty facesContext.maximumSeverity}"/>

       

                     </a>

       

              </div>

       

              <!--      <div id="nomeTela" class="nomeTela">

       

                      <ui:insert name="nomeTela"/>

       

                  </div> nomeTela  -->

       

       

       

                  <rich:panel styleClass="panel" style=" width : 90%;">

       

                      <f:facet name="header">

       

                          <h:outputText>

       

                              <ui:insert name="titulo"/>

       

                          </h:outputText>

       

                      </f:facet>   

       

       

       

                      <ui:insert name="conteudo"/>

       

       

       

       

       

                  </rich:panel>

       

              </div>  <!--conteudo  -->

       

              <div class="rodape">

       

                  &#160;

       

              </div>

       

          </div> <!-- outer -->

       

      </div> <!-- ie6ctr -->

       

      <a4j:loadScript src="resource://resource/js/eq2.comum.js" />

       

      <a4j:loadScript src="resource://resource/js/jquery.overlaymessage.js" />

       

       

       

      <!-- mantendo sessao ativa -->

       

      <a4j:region>

       

          <h:form id="keepSessionAliveForm">

       

              <a4j:poll id="poll" interval="1620000" />

       

          </h:form>

       

      </a4j:region>

       

       

       

      </body>

       

      </f:view>

       

      </html>

       

      -----------

       

      Does anybody has a solution?

       

      Thanks