接缝和漂亮面孔
我正在将 Prettyfaces 3.1.0 与 JSF1.2 和 Seam 2.2.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;
}
映射模式工作正常,但是我总是收到以下异常:
警告:无法创建 Seam 组件,范围未激活:accountAction(PAGE) 警告:JSF1053:(侦听器:com.ocpsoft.pretty.faces.event.PrettyPhaseListener.afterPhase(), 阶段 ID:RESTORE_VIEW 1,视图 ID:/WEB-INF/view/account/account.xhtml)阶段监听器执行期间抛出异常:com.ocpsoft.pretty.PrettyException:处理目标无法访问时发生异常,标识符“accountAction”已解析为空 警告: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)
<代码> 严重:吞咽异常\ java.lang.IllegalStateException:没有活动的对话上下文 在 org.jboss.seam.faces.FacesMessages.instance(FacesMessages.java:352) 在 org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:484) 在 org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:148) 在 org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:118) 在 com.sun.faces.lifecycle.Phase.handleBeforePhase(Phase.java:214) 在 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:96) 在 com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) 在 javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
我做错了什么? 谢谢
i'm using prettyfaces 3.1.0 with JSF1.2 and Seam 2.2.0. I have the following 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>
and 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;
}
Mapping pattern works fine, however i always get the following exception:
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)
What am I doing wrong?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎有什么东西阻止了 Seam ConversationContext 的恢复。
如果无法解决此问题,您可能可以通过在不同阶段(例如 RENDER_RESPONSE)上调用操作来解决此问题。如果为时已晚,那么我建议使用延迟初始化样式的方法来加载帐户信息。 (例如,在 getAccountInfo() 方法中使用本地字段和 null 检查。)
It looks like something is preventing the Seam ConversationContext from being restored.
If that can't be resolved, you can probably get around this by invoking your action on a different phase, RENDER_RESPONSE for example. If that is too late, then I recommend using a lazy-initialization style approach for loading the account information. (Using a local field and a null check in the getAccountInfo() method for example.)