Introduction to modules in Zend Framework 2 -- youtube
2013-11-03 18:05
218 查看
当发生在如下错误的时候,有一个方案可行,
"java.lang.IllegalStateException: Cannot forward after response has been committed “
当你有多个跳转的页面的语句时候,好好检查一下,当 转发 或者 重定向的时候,需要在后加一个retrun 即可。
服务器中不允许多次跳转,否则会下面这个错误。
因为服务器端使用sendRedirect跳转到客户端的时候,不能在使用req.getRequestDispatcher("跳转的页面").forward(req, reqs);
跳转;
所以在跳转之后,return就不会往下执行。
本文转自:/article/4479883.html 感谢原博主!
"java.lang.IllegalStateException: Cannot forward after response has been committed “
当你有多个跳转的页面的语句时候,好好检查一下,当 转发 或者 重定向的时候,需要在后加一个retrun 即可。
服务器中不允许多次跳转,否则会下面这个错误。
因为服务器端使用sendRedirect跳转到客户端的时候,不能在使用req.getRequestDispatcher("跳转的页面").forward(req, reqs);
跳转;
所以在跳转之后,return就不会往下执行。
1.protected void login(HttpServletRequest req, HttpServletResponse reqs) throws ServletException, IOException { 2. // TODO Auto-generated method stub 3. if(req.getUserPrincipal()!=null){ 4. String userID = req.getRemoteUser(); 5. boolean bol = req.isUserInRole(USER_ROLE_ADMIN); 6. UserModel userModel =connectionDao.getUserModelByUserID(userID); 7. if(bol){ 8. req.getSession().setAttribute("user",userModel); 9. reqs.sendRedirect(req.getContextPath()+"/admin/main.jsp"); 10. return; 11. }else{ 12. reqs.sendRedirect(req.getContextPath()+"/index.jsp"); 13. return; 14. } 15. } 16.}
本文转自:/article/4479883.html 感谢原博主!
相关文章推荐
- Business Modules And Interfaces In The SCSF Smart Client Solution (Introduction To CAB/SCSF Part 19)
- Introduction to XQuery in SQL Server 2005
- 使用伪寄存器调试MSVC++程序的介绍--An introduction to debugging in MSVC++ using Pseudoregisters
- All-In-One Code Framework(AIO): 如何使用C#编写进程外的COM组件 (How to write an out-of-proc COM server in C#)
- [Yii Framework] How to run cron job (or use command) in the server with yii framework
- Coursera_An Introduction to Interactive Programming in Python_Mini-project # 8 RiceRock
- An Introduction to Interactive Programming in Python 最后的作业 -- 太空战机
- [Introduction to programming in Java 笔记] 1.3.9 Factoring integers 素因子分解
- Introduction to Programming in C/C++ with Vim
- 【coursera 学习笔记】An Introduction to Interactive Programming in Python--week1
- How To Enable Apache Modules in Ubuntu
- An Introduction to Genetic Algorithms In Java @ JDJ
- How to enable the Xdebug debugger in Zend Studio for Eclips
- How To Get Log, Trace Files In OA Framework Pages And Concurrent Request Programs (文档 ID 290614.1)
- An Introduction to Interactive Programming in Python 第四课作业 Pong
- Coursera-An Introduction to Interactive Programming in Python (Part 1)-Mini-project #4 —"Pong"
- An Introduction to Microsoft .NET Remoting Framework
- Introduction to algorithm in C++
- How to change @INC to find Perl modules in non-standard locations
- Introduction to dynamic two dimensional arrays in C++