---
title: "a:commandButton传参数"
author: "duyunfengsolo"
date: "2009-07-02T17:13:00Z"
tags: []
slug: "a-commandbutton"
draft: false
lastmod: "2009-07-02T17:13:00Z"
id: 419092
url: "https://solodu.iteye.com/blog/419092"
---

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