我想使用primefaces 展示中的示例来对selectOneMenu中的selectItems进行分组:
<h:outputText value="Grouping: " />
<p:selectOneMenu value="#{formBean.car}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{formBean.cars}" />
</p:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)
我的问题是,没有实现bean.现在我不知道,如何在getCars()方法中实现selectItems的分组.我找不到任何其他的例子.
我有一个primefaces(版本3.4.2)滑块和一个inputText用于滑块值的输出值.问题是滑块的更改会更新inputText的显示值,但不会调用setText的setter绑定.
这是我的滑块:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:a4j="http://richfaces.org/a4j">
<h:head>
<title>Zinsrechner</title>
</h:head>
<h:body>
<h:form>
<h:panelGrid columns="1" style="margin-bottom:10px">
<p:inputText id="x" value="#{zinsrechner.monatlicherBeitrag}" />
<p:slider minValue="0" maxValue="150" for="x" />
</h:panelGrid>
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的Setter,不叫:
public void setMonatlicherBeitrag( Double beitrag ) {
monatlicherBeitrag = beitrag;
}
Run Code Online (Sandbox Code Playgroud)
Getter IS被称为:
public Double getMonatlicherBeitrag() {
return GuiParameter.getSpareinlageProMonat();
}
Run Code Online (Sandbox Code Playgroud)