使用 Seam 2.2.2.Final 和 Richfaces 3.3.3.Final。
我需要在用户离开选项卡时执行一个操作,并且此操作只能在所有页面加载后才能执行,每个选项卡内容上都会发生一些 bean init。所以我去阅读了关于 .
问题是,例如,对于 3 个选项卡,当每个选项卡被渲染并为下一个选项卡渲染传递时,该命令被触发。不好,bean 没有初始化,我得到 nullpointer 指向我!
无论如何要防止此标签上的这种行为?当我对一个非常大的应用程序进行改进时,我试图尽可能少地弄乱部署的代码。
提前感谢您查看。这是我的页面的示例代码:
<?xml version="1.0" encoding="ISO-8859-1"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a="http://richfaces.org/a4j"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
template="/WEB-INF/xhtml/templates/frameTemplate.xhtml">
<ui:param name="pageTitle" value="Elaborar relatório, voto e ementa" />
<ui:define name="title">#{pageTitle}</ui:define>
<ui:param name="home" value="#{sessionProcess}" />
<ui:define name="frameBody">
<rich:jQuery query="hide()" selector="#update" timing="onload"/>
<s:div id="allTabs">
<rich:tabPanel title="Tab1" switchType="ajax" style="width: 100%;">
<rich:tab label="Report"
rendered="#{!sessionProcess.hideReport}"
title="Report" style="width: 100%;"
action="#{sessionProcess.setReport()}" immediate="true" ontableave="#{sessionProcess.writeDraftReport()}">
.
.
.
<rich:tabPanel title="Tab2" switchType="ajax" style="width: 100%;">
<rich:tab label="Vote"
rendered="#{!sessionProcess.hideVote}"
title="Report" style="width: 100%;"
action="#{sessionProcess.setVote()}" immediate="true" ontableave="#{sessionProcess.writeDraftVote()}">
.
.
.