当前位置:   article > 正文

java web基础 --- URL重定向Filter_chain.dofilter查看重定向url

chain.dofilter查看重定向url

httpRequest.getRequestDispatcher("/helloWorld").forward(httpRequest, response);

服务器端转发,不改变浏览器端URL地址,常用

httpResponse.sendRedirect(uri);

浏览器端重定向,改变URL在浏览器地址栏


URLOverWriteFilter.java

  1. package com.web1.util;
  2. import java.io.IOException;
  3. import javax.print.attribute.standard.ReferenceUriSchemesSupported;
  4. import javax.servlet.Filter;
  5. import javax.servlet.FilterChain;
  6. import javax.servlet.FilterConfig;
  7. import javax.servlet.ServletException;
  8. import javax.servlet.ServletRequest;
  9. import javax.servlet.ServletResponse;
  10. import javax.servlet.annotation.WebFilter;
  11. import javax.servlet.http.HttpServletRequest;
  12. import javax.servlet.http.HttpServletResponse;
  13. /**
  14. * Servlet Filter implementation class URLOverWriteFilter
  15. */
  16. @WebFilter("/URLOverWriteFi
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/代码吟游诗人/article/detail/61370?site
推荐阅读
相关标签
  

闽ICP备14008679号