I created and ran some quick tests and things seem to work for me. I was testing with the following component:
[code]
<?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:h="
http://java.sun.com/jsf/html"
xmlns:composite="
http://java.sun.com/jsf/composite">
<composite:interface>
<composite:attribute name="value" required="true" />
<composite:editableValueHolder name="theValue" />
<composite:actionSource name="theButton" />
</composite:interface>
<composite:implementation>
<span id="#{cc.clientId}">
<h:inputText id="theValue" value="#{cc.attrs.value}"/>
<h:commandButton id="theButton" value="Test" action="#{inputAndButtonController.handleTestButton(cc.attrs.value)}" />
</span>
</composite:implementation>
</html>
[/code]
The bean was:
[code]
@RequestScoped
@Named
public class InputAndButtonController implements ValueChangeListener, ActionListener {
private String inputValue;
public String getInputValue() {
System.out.println(getClass().getSimpleName() + ".getInputValue() --> " + inputValue);
return inputValue;
}
public void setInputValue(String inputValue) {
System.out.println(getClass().getSimpleName() + ".setInputValue(\"" + inputValue + "\")");
this.inputValue = inputValue;
}
public String handleTestButton(String value) {
System.out.println(getClass().getSimpleName() + ".handleTestButton(\"" + value + "\")");
return null;
}
public String handleTestButtonMojarra(String value) {
System.out.println(getClass().getSimpleName() + ".handleTestButtonMojarra(\"" + value + "\")");
return null;
}
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
System.out.println(getClass().getSimpleName() + ".processValueChange() --> newValue=" + event.getNewValue());
}
public void processAction(ActionEvent event) throws AbortProcessingException {
System.out.println(getClass().getSimpleName() + ".processAction() --> clientId=" + event.getComponent().getClientId());
}
}
[/code]
And the page was:
[code]
<?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:h="
http://java.sun.com/jsf/html"
xmlns:f="
http://java.sun.com/jsf/core"
xmlns:c="
http://java.sun.com/jsf/composite/components">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Custom Components Test</title>
</h:head>
<h:body>
<h:form id="form">
<h:outputLabel for="inComp" value="The Components:" />
<c:inputAndButton id="inComp" value="#{inputAndButtonController.inputValue}">
<f:valueChangeListener for="theValue" binding="#{inputAndButtonController}"/>
<f:actionListener for="theButton" type="com.testapp.web.components.InputAndButtonController"/>
</c:inputAndButton>
<br/>
<h:commandButton value="Submit (Mojarra)" action="#{inputAndButtonController.handleTestButtonMojarra(inputAndButtonController.inputValue)}" />
</h:form>
</h:body>
</html>
[/code]
What did you test with?
[Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]
http://forums.java.net/jive/thread.jspa?messageID=391989