简体   繁体   中英

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

we cant compare, one is Java and another is 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.

depends upon your requirement you can use any of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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