RSS
热门关键字:  java  Ajax  JSP  JSF  Struts
当前位置 : 首页>JSF>列表

JSF控制页面跳转

来源:Robin''s Java World 作者: 时间:2007-10-17 点击:

280 }
281 // Append the trailing "*" so we can do our map lookup;
282 wcFromViewId = fromViewId + "*";
283 caseList = (List) caseListMap.get(wcFromViewId);
284
285 if (caseList == null) {
286 return null;
287 }
288
289 // If we've found a match, then we need to evaluate
290 // from-action/outcome in the following order:
291 // 1) elements specifying both from-action and from-outcome
292 // 2) elements specifying only from-outcome
293 // 3) elements specifying only from-action
294 // 4) elements where both from-action and from-outcome are null
295
296 result = determineViewFromActionOutcome(caseList, fromAction,
297 outcome);
298 if (result != null) {
299 break;
300 }
301 }
302 return result;
303 }
304
305 /** *//**
306 * This method will extract the cases for which a <code>from-view-id</code>
307 * is an asterisk "*". Refer to section 7.4.2 of the specification for more
308 * details.
309 *
310 * @param fromAction
311 * The action reference string.
312 * @param outcome
313 * The outcome string.
314 * @return The <code>view</code> identifier.
315 */
316
317 private synchronized CaseStruct findDefaultMatch(String fromAction,
318 String outcome) {
319 // String returnViewId = null;
320 // if the user has elected to replace the Application instance
321 // entirely
322 if (null == associate) {
323 return null;
324 }
325
326 Map caseListMap = associate.getNavigationCaseListMappings();
327 Util.doAssert(null != caseListMap);
328
329 List caseList = (List) caseListMap.get("*");
330
331 if (caseList == null) {
332 return null;
333 }
334
335 // We need to evaluate from-action/outcome in the follow
336 // order: 1)elements specifying both from-action and from-outcome
337 // 2) elements specifying only from-outcome
338 // 3) elements specifying only from-action
339 // 4) elements where both from-action and from-outcome are null
340
341 return determineViewFromActionOutcome(caseList, fromAction, outcome);
342 }
343
344 /** *//**
345 * This method will attempt to find the <code>view</code> identifier based
346 * on action reference and outcome. Refer to section 7.4.2 of the
347 * specification for more details.
348 *
349 * @param caseList
350 * The list of navigation cases.
351 * @param fromAction
352 * The action reference string.
353 * @param outcome
354 * The outcome string.
355 * @return The <code>view</code> identifier.
356 */
357 private synchronized CaseStruct determineViewFromActionOutcome(
358 List caseList, String fromAction, String outcome) {
359
360 String cncFromAction = null;
361 String fromOutcome = null;
362 String toViewId = null;
363 CaseStruct result = new CaseStruct();
364 int size=caseList.size();
365 ConfigNavigationCase cnc = null;
366 for (int i = 0; i < size; i++) {
367 cnc = (ConfigNavigationCase) caseList.get(i);
368 cncFromAction = cnc.getFromAction();
369 fromOutcome = cnc.getFromOutcome();
370 toViewId = cnc.getToViewId();
371 if ((cncFromAction != null) && (fromOutcome != null)) {
372 if ((cncFromAction.equals(fromAction))
373 && (fromOutcome.equals(outcome))) {
374 result.viewId = toViewId;
375 result.navCase = cnc;
376 return result;
377 }
378 }
379 }
380 for (int i = 0; i < size; i++) {
381 cnc = (ConfigNavigationCase) caseList.get(i);
382 cncFromAction = cnc.getFromAction();
383 fromOutcome = cnc.getFromOutcome();
384 toViewId = cnc.getToViewId();
385 if ((cncFromAction == null) && (fromOutcome != null)) {
386 if (fromOutcome.equals(outcome)) {
387 result.viewId = toViewId;

最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
Google Adsense
相关文章