ログイン フォームを表示し、次のコード スニペットで使用できる複合コンポーネントを作成する必要があります。
<login:loginForm username="#{loginBean.username}"
password="#{loginBean.password}"
action="#{loginBean.login}"/>
@ViewScoped
@ManagedBean
私のloginBeanは、ゲッター、セッター、およびpublic String login()
メソッドを使用した単純なシリアル化可能です。
これは私の複合コンポーネントです:
<body>
<cc:interface>
<cc:attribute name="username" required="true" type="java.lang.String" />
<cc:attribute name="password" required="true" type="java.lang.String" />
<cc:attribute name="action" targets="submit" required="true" method-signature="java.lang.String f()"/>
</cc:interface>
<cc:implementation>
<h3><span xml:lang="en">Login</span> Daten </h3>
<h:form>
<div class="formblock">
<fieldset>
<div>
<h:outputLabel value="Username" for="username"/>
<h:inputText id="username" value="#{cc.attrs.username}"/>
</div>
<div>
<h:outputLabel value="Passwort" for="password"/>
<h:inputSecret id="password" value="#{cc.attrs.password}"/>
</div>
</fieldset>
</div>
<div class="buttons">
<h:commandButton id="submit" value="Anmelden" accesskey="r" />
</div>
</h:form>
</cc:implementation>
</body>
しかし、login:loginForm
ブラウザーで login.xhtml ページ (-snippet を含む) を開くと、jetty ログに次のエラーが表示されます。
Apr 29, 2012 11:59:49 PM org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage retargetMethodExpressions
SEVERE: Inner component submit not found when retargetMethodExpress
しかし、それはどういう意味ですか?私のコードのどこに間違いがありますか? 私はすでにaction
属性を実装するための他のソリューションをいくつか試しましたが、成功しませんでした。