私は解決できない問題を抱えているか、少なくとも jsf に関する限られた知識しかありません。スタックオーバーフローで見つけられるいくつかの良い解決策があることは知っていますが、エラーを理解できません。
ナビゲーションバーのようないくつかのコマンドリンクが必要であり、include 句を取得した定義済みの div タグの内容を変更する必要があります。したがって、私のインデックスは一種のテンプレートとして再解釈できると思います。
私のインデックス:
<h:panelGroup id="navigation" layout="block">
<h:form>
<h:panelGrid columns="4" columnClasses="colDefault,colDefault,colDefault,colDefault">
<f:ajax render=":include">
<h:commandLink value="entry1" action="#{menuController.setPage('login')}" />
<h:commandLink value="entry2" action="#{menuController.setPage('register')}" />
<h:commandLink value="entry3" action="#{menuController.setPage('welcome')}" />
</f:ajax>
</h:panelGrid>
</h:form>
</h:panelGroup>
<h:panelGroup id="center_content" layout="block" class="center_content" >
<h:panelGroup id="include">
<ui:include src="#{menuController.page}.xhtml" />
</h:panelGroup>
</h:panelGroup>
BalusC のこの投稿のように、小さくて非常に単純な Bean を使用します。
@ManagedBean
public class MenuController implements Serializable{
private String page;
public String getPage() {
return page;
}
public void setPage(String page) {
this.page = page;
}
}
しかし、私はTagAttributeException @を得ました
/index.xhtml @17,92 action="#{menuController.setPage('login')}" Could not Resolve Variable [Overflow]: menuController
試してみましたが、どうすればよいかわかりません。