我想使用p:selectOneMenu,如下所示:
<p:selectOneMenu id="actualCustomerSelect"
value="#{customer.currentCustomerUser}"
converter="userDisplayConverter">
<f:selectItems value="#{customer.managers}"
var="manager"
itemLabel="#{manager.userId}"
itemValue="#{manager}"/>
<p:ajax listener="#{customer.customerChangeListener}" partialSubmit="true"
process="@this"></p:ajax>
</p:selectOneMenu>
编辑:
现在我正在使用一个辅助类,它包含User和一个UsersList,如果我将ajax设置为immediate =“true”,那么它会调用监听器,否则不会。 (也没有设置新的customer.currentCustomerUser)
知道如何让它发挥作用吗?
提前谢谢!
转换器:
@FacesConverter("userDisplayConverter")
public class UserDisplayConverter extends AbsJsonConverter {
private static final Log log = LogFactory
.getLog(UserDisplayVOConverter.class);
@Override
public Object getAsObject(Gson gson, FacesContext context, UIComponent component,
String str) {
if (log.isDebugEnabled()) {
log.debug("getAsObject conversion of '" + str + "'");
}
return gson.fromJson(str, User.class);
}
@Override
public String getAsString(Gson gson, FacesContext context, UIComponent component,
Object o) {
User user = (User) o;
if (log.isDebugEnabled()) {
log.debug("getAsString conversion of '" + user.getUserId() + "'");
}
String result = gson.toJson(user);
if (log.isDebugEnabled()) {
log.debug("Conversion result '" + result + "'");
}
return result;
}
}
编辑:
我认为我离这个问题更近了一步:
在ajax响应中我得到validationFailed:true但我没有任何验证器:D