私はこのサイトを持っている:問題アヤックス(クロサギ科2.0.2とPrimefaces 2.0.2)は
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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:p="http://primefaces.prime.com.tr/ui">
<h:head></h:head>
<h:body>
<h:form id="form-some">
<h:inputText id="copingFilePhaseFocus">
<p:ajax event="focus" actionListener="#{installationController.startCopyingWarFile}" />
</h:inputText>
</h:form>
</h:body>
</html>
とバッキング豆:このコードはでした
@ManagedBean(name = "installationController")
@SessionScoped
public class InstallationController implements IPluginInstallationListener {
// Some methods here (...)
public void startCopyingWarFile(ActionEvent event) {
System.out.println("\n\n\n\nStarted\n\n\n\n");
}
}
MyFaces 2.0.0で作業しています。しかし、MyFaces 2.0.2やMojarra 2.0.2ではそうはしません。 「うまくいきません」と言っているのは、入力テキストをクリック(フォーカス)してもactionListener(テキスト "Started"は標準出力に表示されません)がトリガーされないということです。 誰か似たような問題がありますか?
EDIT 1(P変更後:FにAJAXを:AJAX):
<p:outputPanel id="copingFilePhase">
<p:accordionPanel speed="0.2"
rendered="#{pluginInstallerWebBean.copingFilePhase}">
<p:tab
title="#{msg['installPlugin.copyingWar']} ... #{pluginInstallerWebBean.copingFilePhaseState}">
<h:form prependId="false">
<p:focus for="copingFilePhaseFocus" />
<h:inputText id="copingFilePhaseFocus"
rendered="#{pluginInstallerWebBean.copingFilePhaseFocus}"
style="display:none;">
<f:ajax event="focus"
render="copingFilePhase obtainingPluginInformationPhase"
listener="#{installationController.startCopyingWarFile}" />
</h:inputText>
</h:form>
#{msg['installPlugin.copyingWarDescription']}
</p:tab>
</p:accordionPanel>
</p:outputPanel>
<p:outputPanel id="obtainingPluginInformationPhase">(...)</p:outputPanel>
エラーがある:
javax.faces.FacesException: 「は未知のID が含まcopingFilePhase ' - それを見つけることができない コンポーネントの文脈で copingFilePhaseFocus
Ad。 1:web.xmlファイルに適切なエントリがあります。広告。 2:それはまた問題ではない。私はjavax.faces.event.ActionEventを確実にインポートしており、ログファイルにはエラーに関するエントリはありません。 f:Ajaxは正しく動作しているようです。しかし、f:ajaxでは "update"属性の代わりに "render"があります。レンダリングコンポーネントをそのh:フォームコンポーネントの外にレンダリングすることはできますか?コンポーネント "copingFilePhase"が見つかりません。オリジナルの質問にコードを付ける(EDIT:コードが添付されている)。 –
接頭辞IDには ':'が付きます。 – BalusC
例を書くことができますか? –