Вопрос

I want to pass the selected value of a h:selectOneMenu to h:link as a view param. The selected value is always empty. Here's my code:

<h:selectOneMenu value="#{countryLclController.selectedCountry}">
    <f:selectItem itemLabel="#{text['select_country']}" itemValue=""/>
    <f:selectItems value="#{countryLclController.getCountries(request.locale.language)}" var="country" itemLabel="#{country.countryName}" itemValue="#{country.countryName}"/>                                                                                                                                                
    <f:ajax render="visa"/>
</h:selectOneMenu>

<h:link id="visa" outcome="Visa_Guide" includeViewParams="true" value="#{text['visa_guide']}">
    <f:param name="country" value="#{countryLclController.selectedCountry}"/>
</h:link>

the term country is added to outcome since I have the f:viewParam in Visa_Guide.xhtml but country is empty; so the outcome becomes: Visa_Guide?country= country is a String field with getter and setter methods in countryLclController managed bean.

Это было полезно?

Решение

I had forgotten to put my <h:selectonemenu> inside <h:form>.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top