2016-03-03 100 views
1

我正在使用tapestry框架的web應用程序工作。我在我的應用程序中有以下頁面a,b,c,d和Index。 在索引頁面中,檢查一些條件並重定向到特定頁面。 我的代碼,頁面重定向在tapestry5

if(null != cookieVal) { 
    if(cookieVal.equalsIgnoreCase("a")) { 
     return A.class; 
    } else if(cookieVal.equalsIgnoreCase("b")) { 
     return B.class; 
    } else if(cookieVal.equalsIgnoreCase("c")) { 
     return C.class; 
    } else if(cookieVal.equalsIgnoreCase("d")) { 
     return D.class; 
    } 
} 

這裏的條件增加,如果頁面增加。如何優化此條件檢查並重定向到特定頁面。

+0

,你可以從一個'地圖查找<字符串,類>' –

回答