简体   繁体   中英

JSF Unknown System Events

I am working on a JSF 2.0 project, and learning the benefits of using System Events. However, the book I'm referencing 'Core Java Server Faces 3rd Edition' lists a total of 14 system event types that can be used in the f:event tag's type attribute. Some of them work as I would expect, eg "preRenderComponent" on a UIComponent tag, or "preRenderView" on a UIViewRoot tag. But, besides those two, and a select few others, none of the other events mentioned in the book work. For example, I can't get the postRestoreState type of event to work on a UIComponent. Instead, when JSF tries to render the page, I get a ClassNotFound Exception, presumably to the System Event class that is supposed to handle postRestoreState events, or whatever event it is I'm trying to listen for.

Why don't these other event types work? Is there some other library I need, or is there some other way of implementing a system event listener that I need to use. Below is an example of one such tag that is failing:

            <h:commandLink
                action="editPlant"
                value="#{appMessages.UsersNavigationAddPlant}"
                styleClass="#{userSession.selectedStyle}"
                >
                <f:event type="postRestoreState" listener="#{userSession.setSelectedStyle()}" />
            </h:commandLink> 

It appears that you need the full Class name:

<f:event type="javax.faces.event.PostRestoreStateEvent" listener="#{bean.postRestoreState}"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM