首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >selectOneMenu与textEntry in IceFaces

selectOneMenu与textEntry in IceFaces
EN

Stack Overflow用户
提问于 2013-03-05 10:06:49
回答 1查看 2.7K关注 0票数 0

我对IceFaces有问题,我尝试更改ace:textEntry取决于在ice上选择的项目:selectOneMenu。

此外,我不需要去新的页面,我希望它是AJAX和反射,每次我改变它。我试着这样做:

代码语言:javascript
复制
<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:

代码语言:javascript
复制
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;
}

但这行不通,有什么解决办法吗?大块头。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-03-07 03:07:42

首先,您的ace:ajax不在正确的位置。它应该在ice:selectOneMenu下。

其次,我建议您不要使用ice:selectOneMenu,而是使用h:selectOneMenu。随着时间的推移,我了解到,当您不使用ice中的任何内容时,一切都会更好。hace的组合工作得很好。

我创建了一个像您这样的样例项目,我能够让它像这样工作:

代码语言:javascript
复制
<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进行了测试。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15221014

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档