我对 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>
和豆:
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;
}
但它不起作用,有什么解决办法吗?非常感谢。