0

IceFaces に問題があります。ice:selectOneMenu で選択した項目に応じて ace:textEntry を変更してみます。

また、新しいページに移動する必要はありません。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;
}

しかし、それはうまくいきません、何か解決策はありますか?ビッグthx。

4

1 に答える 1

3

まず、あなたace:ajaxは正しい場所にいません。の下にあるはずice:selectOneMenuです。

次に、 を使用する代わりに、 を使用することをお勧めしice:selectOneMenuますh:selectOneMenu。から何も使用しないと、すべてがうまく機能することを時間とともに学びましたice。との組み合わせは非常haceうまく機能します。

あなたのようなサンプル プロジェクトを作成し、次のように動作させることができました。

<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 および JSF 2.1.6 でテスト済み。

于 2013-03-07T03:07:42.510 に答える