-
1. Access to composite component attributtes
boy18nj Mar 3, 2011 5:46 PM (in response to eljot)use action listener or your managed bean itself to get values-
action listener, example-
public class LoginActionListener implements ActionListener {
public void processAction(ActionEvent event) throws AbortProcessingException {
UIComponent container = event.getComponent().getNamingContainer();
String name = (String) ((UIInput)
container.findComponent("form:name")).getValue();
String pwd = (String) ((UIInput)
container.findComponent("form:password")).getValue();
if (Registrar.isRegistered(name, pwd)) return;
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(container.getClientId(),
new FacesMessage("Name and password are invalid. Please try again."));
throw new AbortProcessingException("Invalid credentials");
}
}