我对IceFaces有问题,我尝试更改ace:textEntry取决于在ice上选择的项目:selectOneMenu。
此外,我不需要去新的页面,我希望它是AJAX和反射,每次我改变它。我试着这样做:
<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:ice="http://www.icesoft.com/icefaces/component"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:icecore="http://www.icefaces.org/icefaces/core">
<f:view>
<ice:selectOneMenu partialSubmit="true" onchange="submit()"
value="#{testBean.selectedItem}"
valueChangeListener="#{testBean.selectionChanged}"
immediate="true">
<f:selectItems value="#{testBean.standardList}"
var="itemValue" itemLabel="#{itemValue}"
itemValue="#{itemValue}" />
</ice:selectOneMenu>
<ace:textEntry labelPosition="left" label="Output text: " id="output" value="#{testBean.outputItem}" >
<ace:ajax render="@this"/>
</ace:textEntry>
</f:view>
和bean:
import java.util.Arrays;
import java.util.List;
import javax.faces.bean.CustomScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.event.ValueChangeEvent;
import javax.inject.Inject;
import org.slf4j.Logger;
@ManagedBean
@CustomScoped(value = "#{window}")
public class TestBean {
@Inject
private Logger logger;
private String selectedItem;
private String outputItem;
private List<String> standardList = Arrays.asList("Artur","Adam","Mirek");
public void selectionChanged(ValueChangeEvent e){
this.outputItem = this.selectedItem;
logger.info(this.outputItem);
}
public String getSelectedItem() {
return selectedItem;
}
public void setSelectedItem(String selectedItem) {
this.selectedItem = selectedItem;
}
public List<String> getStandardList() {
return standardList;
}
public void setStandardList(List<String> standardList) {
this.standardList = standardList;
}
public String getOutputItem() {
return outputItem;
}
public void setOutputItem(String outputItem) {
this.outputItem = outputItem;
}但这行不通,有什么解决办法吗?大块头。
发布于 2013-03-07 03:07:42
首先,您的ace:ajax不在正确的位置。它应该在ice:selectOneMenu下。
其次,我建议您不要使用ice:selectOneMenu,而是使用h:selectOneMenu。随着时间的推移,我了解到,当您不使用ice中的任何内容时,一切都会更好。h和ace的组合工作得很好。
我创建了一个像您这样的样例项目,我能够让它像这样工作:
<h:form>
<h:selectOneMenu value="#{Bean.valueOutput}">
<f:selectItems value="#{Bean.values}" />
<f:ajax event="change" render="output"/>
</h:selectOneMenu>
<ace:textEntry labelPosition="left" label="Output text: " id="output" value="#{Bean.valueOutput}" />
</h:form>在Bean.java中没有什么特别之处,只有普通声明和get/set。
使用ICEfaces 3.2和JSF2.1.6进行了测试。
https://stackoverflow.com/questions/15221014
复制相似问题