一、servlet服务端分发forward
二、servlet客户端重新向(返回302状态码)
方法1:
方法2:
response.sendRedirect("test_get.do?name=feinen");
%>
返回:
HTTP/1.1 302 Found
Server: Apache-Coyote/1.1
Set-Cookie: JSESSIONID=C37EF00D5845F2311166BFD8B1243EA4; Path=/springmvc/; HttpOnly
Location: http://localhost:8080/springmvc/static/index.html
Content-Type: text/html
Content-Length: 0
Date: Wed, 23 Nov 2016 14:10:31 GMT
三、spring设置首页
步骤1:
index.jsp
步骤2:index.jsp内容
response.sendRedirect("static/index.html");
%>
踩过的坑:
不能直接在welcome-file里面写static/index.html,因为没办法找到index.html依赖的资源。