XPage 的 beforePageLoad 事件 - 有些代码有效,有些无效

beforePageLoad event of XPage - some code works and some doesn't

下面是 XPage 的 beforePageLoad 事件中的两段代码。假设变量是较早声明的。这就是问题的本质。我已经标记了块 1 和块 2。块 1 执行得很好,但块 2 没有。如果我颠倒顺序,块 2 执行但块 1 不执行。各个块似乎没有任何问题,但 运行 它们一个接一个地出现问题。我的完整代码被一个 try catch 块包围 - 没有收到错误。

我很想知道我做错了什么。

谢谢,

// BLOCK 1 - Get total no of guests on the voyage
var dbTraveler:NotesDatabase  = session.getDatabase(null, 
viewScope.pathDbGuests, false );
var viewTraveler:NotesView = dbTraveler.getView( "(vwGuestInfoByVoyage)" );

if (viewTraveler != null){
var nav:NotesViewNavigator = viewTraveler.createViewNav();
var entry:NotesViewEntry = nav.getFirst();
while (entry != null && !entry.isTotal()) {
if (entry.getColumnValues().firstElement().toString() == viewScope.voyage){
viewScope.cat = entry.getColumnValues().firstElement().toString();
viewScope.voyageGuestCount = entry.getChildCount().toFixed() ;
sessionScope.voyageGuestCount = viewScope.voyageGuestCount;
}else{
var tmpentry:NotesViewEntry = nav.getNextSibling(entry);
}
entry.recycle();
entry = tmpentry;
}
}
viewTraveler.recycle();
viewTraveler = null;


// Block 2 - Load pre-post travel details into an array
if(@Trim(@Left(sessionScope.DebarkEmbark,"@")) == "Embark"){
var viewpreTravel:NotesView = dbTravel.getView("luPreCruiseFlight");
if (viewpreTravel == null){//do nothing
viewScope.preTravelView = "luPreCruiseFlight View not found"
}else{
viewScope.preTravelView = "luPreCruiseFlight View found"
}
}else{
var viewpostTravel:NotesView = dbTravel.getView( "luPostCruiseFlight" );
if (viewpostTravel == null){//do nothing
viewScope.postTravelView = "luPostCruiseFlight View not found"
}else{
viewScope.postTravelView = "luPostCruiseFlight View found"
}
}
viewpreTravel.recycle();
viewpreTravel = null;
viewpostTravel.recycle();
viewpostTravel = null;

您只能转到代码块 1 的 else 块中的下一个视图条目。