sendRedirect()可以作为post方法而不是get? - jsp / servlets [英] Can sendRedirect() act as a post method instead of get? - jsp/servlets
问题描述
我有一个接受用户名和密码的简单表单。如果登录有效,则必须使用 sendRedirect()
方法将页面重定向到一个页面,否则使用另一个页面。我需要使用 sendRedirect()
而不是 forward()
,因为其他页面位于另一个服务器中。我注意到,当使用
response.sendRedirect(response.encodeRedirectURL(FileName.jsp?paramName =+ value));
有没有办法通过sendRedirect()来使用 我能做些什么吗?感谢:) 不,这是不可能的。我看到的唯一(肮脏)解决方法是转发到包含隐藏表单(使用方法POST)和提交此表单的JavaScript脚本的内部页面。 I have a simple form which accepts a username and a password. I have to use the Is there a way to What can I do please? Thanks :) No, it's not possible. The only (dirty) workaround I see is to forward to an internal page containing a hidden form (with method POST) and a JavaScript script submitting this form. 这篇关于sendRedirect()可以作为post方法而不是get? - jsp / servlets的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! GET
方法,因为名称=值正显示在URL中。这对我来说是不可取的,因为我不希望这些值出于安全原因显示在URL中。
POST
这些值?
我尝试使用方法 POST
来完成一个表单,该方法隐藏了我需要的值,但仍然没有运气
sendRedirect()
method for the page to redirect to one page if log in is valid and to another if not. I need to use sendRedirect()
and not forward()
since the other pages are located in another server. I noticed that when usingresponse.sendRedirect(response.encodeRedirectURL("FileName.jsp?paramName=" +value));
sendRedirect()
is using the GET
method since name=value are being shown in the URL. This is not desirable for me since I don't want these values to show in the URL for safety reasons. POST
these values using sendRedirect() ?
I tried to do a form with method POST
which hides the values I need but still no luck