a:commandButton传参数

<a4j:commandButton value="Set Name to Alex"  reRender="rep" > 
    <a4j:actionparam name="username" value="Alex" assignTo="#{userBean.name}"/> 
</a4j:commandButton> 
要后台的BackBean自动设置Alex给userBean.name
或者也可以通过:
Map params = FacesContext.getCurrentInstance().getExternalContext()  
                .getRequestParameterMap();  
String username = (String) params.get("username"); 

你可能感兴趣的:(a:commandButton传参数)