这个问题很简单,但是防止以后忘记还是做下记录,
这个工程是从别的地方过来的,刚开始不是web工程,经过转换后(怎么转换就不做介绍),发现web.xml里面
加上了
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
无效,原因是缺少index.jsp,于是加入这个jsp页面就行了,我这里加上index.jsp后然后又进行了一个跳转
如下
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%
String basePath = request.getContextPath();
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body onload="forwardAction()">
</body>
<script type="text/javascript">
function forwardAction(){
window.location.href = xxxxxxxx;
}
</script>
</html>
本文介绍了如何解决web.xml中欢迎页配置无效的问题,并通过添加index.jsp文件及设置页面跳转来实现正确配置。
16万+

被折叠的 条评论
为什么被折叠?



