我正在使用带有JSF1.2和Seam 2.2.0的prettyfaces 3.1.0。我有以下pretty-config.xml:
<url-mapping id="accountInfo">
<pattern value="/account/#{accountId}/" />
<view-id>/WEB-INF/view/account/account.seam</view-id>
<action onPostback="false">#{accountAction.loadAccountInformation}</action>
</url-mapping>
和Seam bean:
@Name("accountAction")
@Scope(value = ScopeType.PAGE)
public class AccountAction {
@RequestParameter("accountId")
private Long accountId;
@Out(scope = ScopeType.PAGE)
@In(required = false, scope = ScopeType.PAGE)
private AccountDTO accountDto;
}
映射模式工作正常,但我总是得到以下异常:
WARNING: Cannot create Seam component, scope is not active: accountAction(PAGE)
WARNING: JSF1053: (Listener: com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(),
Phase ID: RESTORE_VIEW 1, View ID: /WEB-INF/view/account/account.xhtml) Exception thrown during phase-listener execution: com.ocpsoft.pretty.PrettyException: Exception occurred while processing Target Unreachable, identifier 'accountAction' resolved to null
WARNING: com.ocpsoft.pretty.faces.beans.ActionExecutor.executeActions(ActionExecutor.java:68)
com.ocpsoft.pretty.faces.event.PrettyPhaseListener.processEvent(PrettyPhaseListener.java:204)
com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(PrettyPhaseListener.java:103)
com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:102)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
SEVERE: swallowing exception\
java.lang.IllegalStateException: No active conversation context
at org.jboss.seam.faces.FacesMessages.instance(FacesMessages.java:352)
at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:484)
at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118)
at com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
我做错了什么? 感谢
答案 0 :(得分:2)
看起来有些东西阻止了Seam ConversationContext的恢复。
如果无法解决,您可以通过在不同的阶段调用您的操作来解决这个问题,例如RENDER_RESPONSE。如果为时已晚,那么我建议使用延迟初始化样式方法来加载帐户信息。 (例如,在getAccountInfo()方法中使用本地字段和空检查。)