Sending redirect to another servlet/JSP without loosing the request parameters
来源:互联网 发布:数控机床编程步骤 编辑:程序博客网 时间:2024/06/09 13:41
How do i specify a redirection to another servlet, in the doPost()
method of a servlet.
at the moment I’m using
request.getRequestDispatcher("/WEB-INF/products.jsp").forward(request, response);
which is wrong since, my parameters in the doGet() method of products
are not being called and initialized.
So I’m left with an empty products page after logging in :/
You need to use HttpServletResponse#sendRedirect()
to send a redirect. Assuming that the servlet is mapped on an URL pattern of /products
:
response.sendRedirect("/products");
This way the webbrowser will be instructed to fire a new HTTP GET request on the given URL and thus the doGet()
method of the servlet instance will be called where you can in turn load the products and forward to a JSP which displays them the usual way.
0 0
- Sending redirect to another servlet/JSP without loosing the request parameters
- Sending the User to Another App
- Sending the User to Another App
- Sending the User to Another App
- Sending Parameters to JasperReport
- XMLHttpRequest - Sending a Request to the Server
- 16Sending the User to Another App(隐式Intent意图)
- Sending parameters to another web page(网页间的参数传递)
- 1231 Sending the Request
- Example - Sending Parameters To main Function (linux)
- Mapping request parameters to action method parameters
- "A transport-level error has occurred when sending the request to the server"的解决办法
- How to save the currently edited row without moving to another row
- Redirect Apache Request to Tomcat
- Sequentially Sending Request to WebService Server
- Sharing Files with NFC ->Sending Files to Another Device
- C#恢复数据库之后,出现错误transport-level error has occurred when sending the request to the server
- SSH to another linux machine without password
- 最长公共子序列(LCS)
- HDU-5455 Fang Fang(2015沈阳网赛,带坑点水题)
- lucene的使用详解
- xcode7,ios9 部分兼容设置
- 同一Activity实例被多次重复创建的解决方法
- Sending redirect to another servlet/JSP without loosing the request parameters
- Android 音频录制(Audio Capture)
- 检查iOS项目中是否使用了IDFA
- IP,子网掩码,默认网关和DNS都是什么,有什么用
- Struts2开发-i18n国际化实现案例-登录页面
- 黑马程序员——IOS学习笔记(Object-c基础)
- 生活中的MVC模式,一个吃货的理解
- C#/Net代码精简优化技巧(2)
- linux shell 管道命令(pipe)使用及与shell重定向区别