Created
October 14, 2011 03:30
-
-
Save steppat/1286181 to your computer and use it in GitHub Desktop.
Simples bean para um formulario JSF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.caelum.bean; | |
import javax.faces.component.UIForm; | |
/* | |
No faces-config.xml | |
<managed-bean> | |
<managed-bean-name>formularioBean</managed-bean-name> | |
<managed-bean-class>br.com.caelum.bean.FormularioBean</managed-bean-class> | |
<managed-bean-scope>session</managed-bean-scope> | |
</managed-bean> | |
*/ | |
public class FormularioBean { | |
private Double valor; | |
private UIForm form; | |
public UIForm getForm() { | |
return form; | |
} | |
public void setForm(UIForm form) { | |
this.form = form; | |
//infos sobre component tree | |
if(!form.getChildren().isEmpty()) { | |
System.out.println("Input Value: " + ((javax.faces.component.UIInput)form.getChildren().get(0)).getValue()); | |
System.out.println("Input Submitted Value: " +((javax.faces.component.UIInput)form.getChildren().get(0)).getSubmittedValue()); | |
System.out.println("Input Local Value: " +((javax.faces.component.UIInput)form.getChildren().get(0)).getLocalValue()); | |
System.out.println("Validator : " +((javax.faces.component.UIInput)form.getChildren().get(0)).getValidators()[0]); | |
System.out.println("UICommand Expression: " +((javax.faces.component.UICommand)form.getChildren().get(1)).getActionExpression().getExpressionString()); | |
} | |
} | |
public void mostra() { | |
System.out.println("metodo mostra() foi chamdo ..."); | |
} | |
public Double getValor() { | |
return valor; | |
} | |
public void setValor(Double valor) { | |
this.valor = valor; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment