我使用JSF 2.2 PrimeFaces 5.3和我試圖與p:autoComplete
號碼:自動完成 - 傳遞的參數
我覺得我做某種類型的語法錯誤的工作,但我不能夠找到它
我有這片
<h:selectOneMenu id="countryDropdown" value="#{myController.selectedCountryId}">
<f:selectItems value="#{myController.countries}" var="co" itemValue="#{co.id}" itemLabel="#{msg[co.name]}"/>
</h:selectOneMenu>
<p:autoComplete
dropdown="true"
value="#{myController.selectedAutocompleteId}"
completeMethod="#{myController.callMyAutocompleteMethod}">
<f:attribute name="selectedCountryId" value="#{carCountryDropdown}" />
</p:autoComplete>
頁的爲了進行自動完成任務,我需要「countryDropdown」也值。 我需要使用哪種語法才能在自動完成方法中檢索「countryDropdown」選擇項的值?
內自動完成的方法,我可以使用下面的代碼
UIComponent.getCurrentComponent(context).getAttributes().get("selectedCountryId");
,但我總是得到空。
你能幫我嗎?
爲什麼不直接使用'countryDropDown'中的ajax在自動完成方法中選擇並使用bean值時設置它的值? – Kukeltje
因爲我會執行太多無用的請求 – Gavi
有多少個?一?二?好的... – Kukeltje