rich:select not bring the value in listener class
maran_su Feb 25, 2013 8:54 AMHi 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);
}
}
}
------------------------------------------------------------------------------------------------------------------------------
-
RichSelect.png 17.2 KB