开发者

Templates with Facelets and calling action from template's component?

开发者 https://www.devze.com 2023-01-05 03:07 出处:网络
I\'m a newbie in JSF, facelet, richfaces... and I understood managed beans, methods called within JSF components

I'm a newbie in JSF, facelet, richfaces... and I understood managed beans, methods called within JSF components However, I wanted to use facelets template with the ui:composition, ui:define, like master pages in asp.net

But I have an action that's meant to be called in a masterpage component... and I keep having the same error :

javax.servlet.ServletException: #{connectionMB.logOut}: javax.el.MethodNotFoundException: /masterPage.html @134,65 action="#{connectionMB.logOut}": Method not found: ConnectionBean

because the component is on the template page masterPage.html :

<jsf:commandLink id="link" action="#{connectionMB.logOut}" >Log Out</jsf:commandLink>

and the user action com开发者_如何学Goes from other html pages which begin with :

the pages are treated server side, apache mixes the masterPages elements with the content of other pages... but how I am supposed to make an action called on a component's masterPage work for any pages ?

in my faces-config I tried lots of things :

<navigation-rule>
<from-view-id>/MySiteName/*</from-view-id>
<navigation-case>
        <from-action>#{connectionMB.logOut}</from-action>

or

<from-view-id>*</from-view-id>

or

<from-view-id>/masterPage.html</from-view-id>

none of this works...

if someone got a clue... thank you so much !


Your problem is (currently) not in the navigation cases. For them - you can totally omit the <from-view-id>.

The problem is that your ConnectionBean does not have a public String logOut() method (it can be void as well).


ok that was entirely my fault. You can of course call a method from a master page without even specifying some navigation-rule. My project had some errors, and so didn't compile the last things I developed. that's all ... thank you anyway !

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号