9 Replies Latest reply on Jun 13, 2011 10:23 AM by Ilya Shaikovsky

    problems with commandButton, commandLink don't work

    David Sanchez Newbie

      Hi,

      all examples from http://richfaces-showcase.appspot.com/ don't work to me. For example, the a4j:coomandLink ( http://richfaces-showcase.appspot.com/richfaces/component-sample.jsf?demo=commandLink&skin=blueSky ) don't work. I put a log tag and I can see the follow error:

       

      info [14:32:33.250]: Received 'begin' event from <a id=j_idt5:j_idt9 ...>

      info [14:32:33.265]: Received 'beforedomupdate' event from <a id=j_idt5:j_idt9 ...>

      info [14:32:33.265]: Server returned responseText: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html><head><title>GlassFish Server Open Source Edition 3.1 - Error report</title><style type="text/css"><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 404 - </h1><hr/><p><b>type</b> Status report</p><p><b>message</b></p><p><b>description</b>The requested resource () is not available.</p><hr/><h3>GlassFish Server Open Source Edition 3.1</h3></body></html>

      error[14:32:33.281]: Received 'error@httpError' event from <a id=j_idt5:j_idt9 ...>

      error[14:32:33.281]: [404] undefined: undefined

      info [14:32:33.281]: Received 'complete' event from <a id=j_idt5:j_idt9 ...>

       

      I don't know why always this error.

       

      Anybody can help me?

       

      Thank you.

        • 1. Re: problems with commandButton, commandLink don't work
          David Sanchez Newbie

          My configuration is: Richfaces 4.0, JSF 2.0 , it is necessary configure web.xml or faces-config.xml to work with ajax4jsf? I think that it is not necessary.

          • 2. Re: problems with commandButton, commandLink don't work
            Kike Gil Novice

            can you put your code???

            • 3. Re: problems with commandButton, commandLink don't work
              David Sanchez Newbie

              Yes, my friend. This is the simple code:

               

              <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich">
                  <h:outputStylesheet>
                      .outhello { font-weight: bold;}
                  </h:outputStylesheet>
                  <h:form>
                      <h:panelGrid columns="3">
                          <h:outputText value="Name:" />
                          <h:inputText value="#{userBean.name}" />
                          <a4j:commandLink value="Say Hello" render="out" execute="@form" />
                      </h:panelGrid>
                  </h:form><br /><a4j:outputPanel id="out">
                      <h:outputText value="Hello #{userBean.name} !" styleClass="outhello" /></a4j:outputPanel></ui:composition>
              I'll be grateful if you can help me.
              Thank you.
              • 4. Re: problems with commandButton, commandLink don't work
                Kike Gil Novice

                i have tested your code an works fine, so, the problem is not the link.

                 

                it seems some configuration with web.xml or the server glassfish i dont know

                 

                search in goole with this "http status 404 the requested resource is not available", maybe you see something

                • 5. Re: problems with commandButton, commandLink don't work
                  Nick Belaevski Master

                  Hi David,

                   

                  Does h:commandLink work in your case?

                  • 6. Re: problems with commandButton, commandLink don't work
                    Kike Gil Novice

                    yes, your code works fine in my form

                    • 7. Re: problems with commandButton, commandLink don't work
                      Kike Gil Novice

                      sorry i think the message was for me

                      • 8. Re: problems with commandButton, commandLink don't work
                        David Sanchez Newbie

                        yes, h:commandLink works ok. The problem is because I have MVC with Spring. JSF works ok, but when I use Richfaces 4, JSF 2.0 with Spring MVC don't work. I think the problem can be the web.xml. This is my xml:

                         

                        <?xml version="1.0" encoding="UTF-8"?>
                        <web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
                            <display-name>JavaServerFaces</display-name>
                            <context-param>
                                <param-name>contextConfigLocation</param-name>
                                <param-value>
                                 classpath:META-INF/spring_security/applicationContext-security.xml
                                </param-value>
                            </context-param>
                            <context-param>
                                <param-name>webAppRootKey</param-name>
                                <param-value>SIPEC.root</param-value>
                            </context-param>
                            <context-param>
                                <param-name>log4jConfigLocation</param-name>
                                <param-value>classpath:log4j.properties</param-value>
                            </context-param>
                            <context-param>
                                <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                                <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                            </context-param>
                            <context-param>
                                <param-name>javax.faces.PROJECT_STAGE</param-name>
                                <param-value>Development</param-value>
                            </context-param>
                            <context-param>
                                <param-name>org.richfaces.skin</param-name>
                                <param-value>deepMarine</param-value>
                            </context-param>
                            <context-param>
                                <param-name>org.richfaces.enableControlSkinning</param-name>
                                <param-value>true</param-value>
                            </context-param>
                            <context-param>
                                <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                                <param-value>.xhtml</param-value>
                            </context-param>
                            <filter>
                                <filter-name>encoding-filter</filter-name>
                                <filter-class>
                                    org.springframework.web.filter.CharacterEncodingFilter
                                </filter-class>
                                <init-param>
                                    <param-name>encoding</param-name>
                                    <param-value>UTF-8</param-value>
                                </init-param>
                            </filter>
                            <filter>
                                <filter-name>springSecurityFilterCert</filter-name>
                                <filter-class>es.mde.sipec.security.filter.X509SecurityFilter</filter-class>
                            </filter>
                            <filter>
                                <filter-name>springSecurityFilterChain</filter-name>
                                <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
                            </filter>
                            <filter>
                                <display-name>RichFaces Filter</display-name>
                                <filter-name>richfaces</filter-name>
                                <filter-class>org.ajax4jsf.Filter</filter-class>
                            </filter>
                            <filter-mapping>
                                <filter-name>encoding-filter</filter-name>
                                <url-pattern>/*</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>springSecurityFilterCert</filter-name>
                                <url-pattern>/inicio.jsp</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>springSecurityFilterChain</filter-name>
                                <url-pattern>*.html</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>springSecurityFilterChain</filter-name>
                                <url-pattern>*.htm</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>springSecurityFilterChain</filter-name>
                                <url-pattern>/j_spring_security_check</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>springSecurityFilterChain</filter-name>
                                <url-pattern>/j_spring_security_logout</url-pattern>
                            </filter-mapping>
                            <filter-mapping>
                                <filter-name>richfaces</filter-name>
                                <servlet-name>Faces Servlet</servlet-name>
                                <dispatcher>REQUEST</dispatcher>
                                <dispatcher>FORWARD</dispatcher>
                                <dispatcher>INCLUDE</dispatcher>
                            </filter-mapping>
                            <listener>
                                <listener-class>
                          org.springframework.web.context.ContextLoaderListener
                        </listener-class>
                            </listener>
                            <listener>
                                <listener-class>
                          org.springframework.web.context.request.RequestContextListener
                        </listener-class>
                            </listener>
                            <listener>
                                <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
                            </listener>
                            <listener>
                                <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
                            </listener>
                            <listener>
                                <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
                            </listener>
                            <servlet>
                                <servlet-name>SIPECGestionMVC</servlet-name>
                                <servlet-class>es.mde.sipec.gestion.dispatcher.DispatcherSipec</servlet-class>
                                <init-param>
                                    <param-name>contextConfigLocation</param-name>
                                    <param-value>classpath:META-INF/spring_mvc/SIPECGestionMVC-servlet.xml</param-value>
                                </init-param>
                                <load-on-startup>1</load-on-startup>
                            </servlet>
                            <servlet>
                                <servlet-name>Faces Servlet</servlet-name>
                                <servlet-class>es.mde.sipec.gestion.dispatcher.DispatcherSipec</servlet-class>
                                <init-param>
                                    <param-name>contextConfigLocation</param-name>
                                    <param-value>classpath:META-INF/spring_mvc/SIPECGestionJSF-servlet.xml</param-value>
                                </init-param>
                                <load-on-startup>1</load-on-startup>
                            </servlet>
                            <servlet>
                                <servlet-name>Faces Servlet2</servlet-name>
                                <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                                <load-on-startup>1</load-on-startup>
                            </servlet>
                            <servlet-mapping>
                                <servlet-name>SIPECGestionMVC</servlet-name>
                                <url-pattern>*.html</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>SIPECGestionMVC</servlet-name>
                                <url-pattern>*.htm</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>Faces Servlet</servlet-name>
                                <url-pattern>/faces/*</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>Faces Servlet</servlet-name>
                                <url-pattern>*.jsf</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>Faces Servlet</servlet-name>
                                <url-pattern>*.faces</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>Faces Servlet2
                                </servlet-name>
                                <url-pattern>*.xhtml</url-pattern>
                            </servlet-mapping>
                            <servlet-mapping>
                                <servlet-name>Faces Servlet</servlet-name>
                                <url-pattern>*.pp</url-pattern>
                            </servlet-mapping>
                            <welcome-file-list>
                                <welcome-file>loginForm.jsp</welcome-file>
                            </welcome-file-list>
                        </web-app>

                        Can you see something in this ?

                         

                        Thank you!

                         

                         

                        • 9. Re: problems with commandButton, commandLink don't work
                          Ilya Shaikovsky Master

                          at first while using RF 4.0 - you should not define any filters in web.xml