JSF参数传递方式之四:f:attribute标签传递
页面到Bean的参数传递
页面中设置参数:
后台取参数:
页面中设置参数:
- <h:form>
- <h:commandButtonaction= "#{paramBean.test3}" value= "Test11" actionListener= "#{paramBean.changeName}" >
- <f:attributename= "name" value= "hujilie" />
- </h:commandButton>
- <h:commandLinkaction= "#{paramBean.test3}" value= "Test12" actionListener= "#{paramBean.changeName}" >
- <f:attributename= "name" value= "hujilie" />
- </h:commandLink>
- </h:form>
- public void changeName(ActionEvente)
- {
- UIComponentcomponent=e.getComponent();
- Map<String,Object>map=component.getAttributes();
- setName((String)map.get( "name" ));
- }
JSF参数传递方式之五:f:setPropertyActionListener 标签传递
页面到Bean的参数传递
页面中设置参数:
页面中设置参数:
- <h:form>
- <h:commandButtonaction= "#{paramBean.test3}" value= "Test14" >
- <f:setPropertyActionListenervalue= "hujilie" target= "#{paramBean.name}" />
- </h:commandButton>
- <h:commandLinkaction= "#{paramBean.test3}" value= "Test15" >
- <f:setPropertyActionListenervalue= "hujilie" target= "#{paramBean.name}" />
- </h:commandLink>
- </h:form>
JSF参数传递方式之四:f:attribute标签传递+五:f:setPropertyActionListener 标签传递