JSF access html element value in bean class

后端 未结 2 1926
情深已故
情深已故 2020-12-20 07:35

I have a JSF application in which I have a combo box.



        
相关标签:
2条回答
  • 2020-12-20 07:53

    Because Process Events happens before Update Model Values you can retrieve the value from the component, from the UIViewRoot like this:

    HtmlSelectOneMenu collectorTypeSelectMenu = (HtmlSelectOneMenu) FacesContext.getCurrentInstance().getViewRoot().findComponent("editForm:collectorType");
    String collectorType = (String) collectorTypeSelectMenu.getValue();
    
    0 讨论(0)
  • 2020-12-20 07:55

    try put the attributes process and partialSubmit in your ajax call with the values you need process like this:

    <f:ajax event="change" 
       execute="@this" 
       render="dsTransformationRule dsCorrelationRule"
       process="@this, collectorType"
       partialSubmit="true"
       listener="#{activityDataSource.handleCollectorTypeChange}" />
    

    In the process atrribute you can put all ids you need to process with the updated values (like you see in the screen.

    0 讨论(0)
提交回复
热议问题