0
votes

I have an issue to fill property placeholder for JSF passthrough element:

JSF:

xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
<!-- ... -->
<h:selectOneMenu value="#{page.selectedCategoryDataKey}" id="mobileFilters" valueChangeListener="#{page.newCategorySelected}" layout="lineDirection" enhanced="true">
    <f:selectItem value="#{null}" itemLabel="#{messages.category_all}"/>
    <f:selectItems value="#{manager.dataEntryList}" var="categoryEntry" itemValue="#{categoryEntry.key}"
        itemLabel="#{categoryEntry.value.categoryName}"
        pt:data-track-name="See-#{categoryEntry.key}"/>
    <f:ajax execute="@this" render="@form -list"/>
</h:selectOneMenu>

HTML I get

<select id="mobileFilterSelectForm-mobileFilters" name="mobileFilterSelectForm-mobileFilters" size="1" onchange="m.ab(this,event,'valueChange','@this','@form list')">	<option value="" selected="selected">All</option>
	<option value="Some" data-track-name="See-">Some</option>
	<option value="Most Popular" data-track-name="See-">Most Popular</option>
	<option value="New" data-track-name="See-">New</option>
	<option value="Instant" data-track-name="See-">Instant</option>
</select>
As you can see data-track-name does not contain value concatenated to See- string, as it is evaluated to itemValue or itemLabel.

Can it be possible that passthrough does not evaluate placeholders as for regular JSF attributes? Any ideas how to get it evaluated?

2
Eventually I've ended up using c:forEach tag from xmlns:c="xmlns.jcp.org/jsp/jstl/core" instead of f:selectItems, that allowed to fill the data-track-name attribute value from a placeholder. - Dagaz

2 Answers

0
votes

If you set execute="@this" then none of the input fields will be executed by the JSF framework. Set its value to @parent or @form or list the necessary input field IDs. Render just specify the components to be rendered. Execute specify what postback parameters to be converted, validated, event listeners called and copied to the model.

It should work:

<f:ajax execute="@parent".../>
0
votes

JSF will evaluate value expressions in the placeholder attributes. However as you've found it's not able to evaluate them when you're using the iteration var inside of selectItems; I tested both cases. It looks like a bug.