1 Reply Latest reply on Feb 26, 2013 2:52 AM by maran_su

    rich:select not bring the value in listener class

    maran_su

      Hi  Everyone,

       

                              i am tying to bring the selected value of drop down using rich:select, i am using richfaces 4.2.2.Final.if i select any value in the drop down it always shows 0.

      can any one suggest the solution.

       

      following is my code. for xhtml and bean class

       

      <?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:f="http://java.sun.com/jsf/core"

                xmlns:s="http://jboss.org/schema/seam/taglib"

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

                xmlns:rich="http://richfaces.org/rich">

       

       

      <ui:composition template="template.xhtml">

       

        

                <ui:define name="content">

                          <rich:select id="prop" defaultLabel="Enter some value"

                                    value="#{rtpGoal.compound_property_id}">

                                    <f:selectItems id="h1" value="#{register.getAllCompoundProperties()}"

                                              var="c" itemLabel="#{c.compound_property_name}"

                                              itemValue="#{c.compound_property_id}" />

                                    <a4j:ajax event="change" listener="#{register.assignValue}"

                                              immediate="true" execute="@this" />

                          </rich:select>

       

       

                          <h:inputText value="#{rtpGoal.compound_property_id}" id="cmdProps" />

       

                 </ui:define>

        </ui:composition>

      </html>

       

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

       

      @Stateless

      @Name("register")

      public class RegisterAction implements Register

      {

       

       

       

      @Override

      public void assignValue(AjaxBehaviorEvent abe) {

                Object obj=abe.getComponent().getAttributes().get("value");

                if(null!=obj){

                          rtpGoal.setCompound_property_id((Integer)obj);

                }

       

      }

       

       

       

      }

       

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

        • 1. Re: rich:select not bring the value in listener class
          maran_su

          Hi,

           

              I am trying to bring the normal ajax support in richfaces 4.2.2 it not working, in order  to support ajax what i need to do,

          here with i  attached the web.xml and  xhtml files can any one guide me .

           

          apart from rich:select i have tried normal text box rendering with ajax that also not working,i suspect there is some configuration is missing...in web.xml or pom.xml

           

          can any one help me.

           

           

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

          <?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:f="http://java.sun.com/jsf/core"

                    xmlns:s="http://jboss.org/schema/seam/taglib"

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

                    xmlns:rich="http://richfaces.org/rich">

           

           

          <ui:composition template="template.xhtml">

                        <ui:define name="content">

           

                                  <rich:select id="prop" defaultLabel="Enter some value"       value="#{compundProperties.compound_property_id}" >

                                    <f:selectItems id="h1" value="#{register.getAllCompoundProperties()}"  var="c" itemLabel="#{c.compound_property_name}" itemValue="#{c.compound_property_id}" />

                                    <a4j:ajax event="selectitem"  render="output" execute="@this" />

                       </rich:select>

           

                                 <h:panelGroup id="output">

                                         <h:inputText value="#{compundProperties.compound_property_id}" id="cmdProps" reRender="prop" />

                                 </h:panelGroup>

                      </ui:define>

            </ui:composition>

          </html>

           

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

           

          web.xml

           

           

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

          <web-app version="3.0" 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_3_0.xsd">

           

           

                    <display-name>SeamSpace Example</display-name>

           

           

                    <!-- RichFaces -->

           

           

                    <context-param>

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

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

                    </context-param>

           

           

                    <!-- Seam -->

           

           

                    <listener>

                              <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>

                    </listener>

           

           

                    <servlet>

                              <servlet-name>Seam Resource Servlet</servlet-name>

                              <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>

                    </servlet>

           

           

                    <servlet-mapping>

                              <servlet-name>Seam Resource Servlet</servlet-name>

                              <url-pattern>/seam/resource/*</url-pattern>

                    </servlet-mapping>

           

           

                    <filter>

                              <filter-name>Seam Filter</filter-name>

                              <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>

                    </filter>

           

           

                    <filter-mapping>

                              <filter-name>Seam Filter</filter-name>

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

                    </filter-mapping>

           

           

                    <context-param>

                              <param-name>facelets.DEVELOPMENT</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>

           

           

                    <!-- 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>

           

           

                    <servlet-mapping>

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

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

                    </servlet-mapping>

           

           

                    <!-- Content Servlet -->

           

           

                    <servlet>

                              <servlet-name>Content Servlet</servlet-name>

                              <servlet-class>org.jboss.seam.example.seamspace.ContentServlet</servlet-class>

                    </servlet>

           

           

                    <servlet-mapping>

                              <servlet-name>Content Servlet</servlet-name>

                              <url-pattern>/content/*</url-pattern>

                    </servlet-mapping>

           

           

                    <session-config>

                              <session-timeout>10</session-timeout>

                    </session-config>

          </web-app>

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