JSF参数传递方式之四:f:attribute标签传递

页面到Bean的参数传递
页面中设置参数:
<h:form>
			<h:commandButton action="#{paramBean.test3}" value="Test11" actionListener="#{paramBean.changeName}">
				<f:attribute name="name" value="hujilie"/>
			</h:commandButton>
			<h:commandLink action="#{paramBean.test3}" value="Test12" actionListener="#{paramBean.changeName}">
				<f:attribute name="name" value="hujilie"/>
			</h:commandLink>
	</h:form>
后台取参数:
public void changeName(ActionEvent e)
    {
        UIComponent component = e.getComponent();
        Map<String, Object> map = component.getAttributes();
        setName((String)map.get("name"));
    }

你可能感兴趣的:(java,bean,JSF,F#)