単純な3行のjsfページとバッキングBeanがあります。ページでコマンドボタンを使用しています。私がajaxと呼んでいるOnclickイベント。ここで、ajaxメソッドは出力テキストコンポーネントを子に追加します。今問題はです。出力テキストコンポーネントは、ページのクリックではなく、ページの読み込み時にレンダリングされます。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
<h:form>
<h:commandButton id="button1" action="return false" value="Submit">
<f:ajax execute="#{bb.method1()}" render="@form" transient="true" event="click" />
</h:commandButton>
</h:form>
</h:body>
</html>
バッキングBeanコード
@Named("bb")
@SessionScoped
public class BackingBean implements Serializable {
public BackingBean() {
}
public void method1()
{
HtmlOutputText out=new HtmlOutputText();
out.setValue("Text1");
FacesContext context=FacesContext.getCurrentInstance();
context.getViewRoot().getChildren().add(out);
context.getViewRoot().setTransient(true);
}
}
ボタンをクリックするとfirebugshowstatus 200 OK ..しかし、ページに変更はありません