Skip to main content

Composite components pass variables

2 replies [Last post]
neverminddenis
Offline
Joined: 2009-11-23

I have a problem. I need to pass variables to action method at my composite components. As far as I understand cc.attrs is request scoped. When I click on button

i receive null instead of name. So how to pass name to my controller bean? Please somebody help me

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
neverminddenis
Offline
Joined: 2009-11-23

Thank you, vesuvius. It really works. Your answer help me to understand where problem was. I use mojarra with icefaces 2.0 jsf implementation. So problem was at icefaces side

vesuvius
Offline
Joined: 2007-06-02

I created and ran some quick tests and things seem to work for me. I was testing with the following component ([b][/b]):

[code]

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite">












[/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]


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


Custom Components Test














[/code]

What did you test with?