servlet中如何根据不同的条件转道不同的页面?
求助!
搜索更多相关主题的帖子:
servlet 转道 条件 页面
----------------解决方案--------------------------------------------------------
用
+++++++++++++++++++++
String toUrl = "/page1.jsp";
if(condition1){
toUrl = "/page2.jsp";
}
else if(condition2){
toUrl = "/page3.jsp";
}
+++++++++++++++++++++
getServletConfig().getServletContext().getRequestDispatcher(toUrl).forward(request,response);
判断
不知道你问的是这个吗?
----------------解决方案--------------------------------------------------------
差不多,以前见过,现在忘了.谢了
----------------解决方案--------------------------------------------------------