简体   繁体   English

JSP:通过表单或response.sendRedirect重定向到其他页面

[英]JSP : Redirecting to other page by form or by response.sendRedirect

<form action="welcome.jsp">  
<input type="submit" value="go"><br/>  
</form> 

OR 要么

response.sendRedirect("welcome.jsp");

Is there any difference between both of them or just we have to click the submit button in first one and other one will go directly to welcome.jsp 两者之间是否有任何区别,或者只是我们必须单击第一个按钮中的“提交”按钮,而另一个将直接转到welcome.jsp

we cant compare, one is Java and another is HTML 我们无法比较,一个是Java,另一个是HTML

response.sendRedirect("welcome.jsp"); in this case we don't need to invoke any event. 在这种情况下,我们不需要调用任何事件。

where as in case of submit we require submit or any other event. submit情况下,我们需要提交或任何其他事件。

depends upon your requirement you can use any of them. 根据您的要求,您可以使用其中任何一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM