1 16 package org.apache.myfaces.examples.example1; 17 18 import javax.faces.component.UIComponent; 19 import javax.faces.context.FacesContext; 20 import javax.faces.el.VariableResolver; 21 import javax.faces.event.AbortProcessingException; 22 import javax.faces.event.ActionEvent; 23 import javax.faces.event.ActionListener; 24 25 30 public class UCaseActionListener 31 implements ActionListener 32 { 33 public void processAction(ActionEvent event) throws AbortProcessingException 34 { 35 FacesContext facesContext = FacesContext.getCurrentInstance(); 36 UIComponent component = event.getComponent(); 37 38 VariableResolver vr = facesContext.getApplication().getVariableResolver(); 39 UCaseForm form = (UCaseForm)vr.resolveVariable(facesContext, "ucaseForm"); 40 if (component.getId().equals("ucaseButton")) 41 { 42 form.uppercase(); 43 } 44 else 45 { 46 form.lowercase(); 47 } 48 } 49 } 50 | Popular Tags |