eclipse自動生成的jsp中沒有
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<base href="<%=basePath%>">
我們可以自己設置jsp模版,方法如下:
eclipse -- >perferences - >web ->jsp - jsp files -Editor ->templates:
選擇JSP with html markup,點擊右邊的Edit進入編輯界面
添加自己想要添加的東西進去,保存
新建的jsp如下: