老师我这个就是按照视频做的为什么我这个访问不到页面呢
----index.jsp-----
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE" />
<title>JavaWeb实现导入导出</title>
<link href="css/all.css" rel="stylesheet" type="text/css" />
<link href="css/pop.css" rel="stylesheet" type="text/css" />
<link href="css/index.css" rel="stylesheet" type="text/css" />
<script src="js/index.js" type="text/javascript"></script>
</head>
<body>
<!-- 蒙版DIV -->
<div id="mengban" style="display: none"></div>
<form method="post">
<div id="header">
<div class="iheader">
<div class="logo">
<a href="#"><img src="" alt="" height="88px" width="99px" /></a>
</div>
<div style="height: 44px;"></div>
<ul class="nav" id="mainMenuUl">
<li class="on"><a><span>导入/导出</span></a></li>
</ul>
</div>
</div>
<div id="container">
<table style="vertical-align: top" cellspacing="0" cellpadding="0"
bgcolor="#e1e9eb" border="0">
<tbody>
<tr>
<td class="leftTd" style="vertical-align: top" width="150">
<div class="left">
<div class="ileft" id="menuDiv">
<h3 onclick="clickSecondMenu(this,'${basePath}/importExcelInit')">
<a>导入Excel</a>
</h3>
<h3 onclick="clickSecondMenu(this,'${basePath}/exportExcelInit')">
<a>导出Excel</a>
</h3>
<h3 onclick="clickSecondMenu(this,'${basePath}/importWordInit')">
<a>导入Word</a>
</h3>
<h3 onclick="clickSecondMenu(this,'${basePath}/exportWordInit')">
<a>导出Word</a>
</h3>
</div>
</div>
</td>
<td width="7">
<div class="pointer"></div>
</td>
<td style="vertical-align: top" height="600px" width="100%">
<br/><iframe id="mainPage" src="" frameborder="0" height="580px" width="100%"></iframe><br />
</td>
</tr>
</tbody>
</table>
</div>
<div id="footer">
<div class="copyright">慕课网</div>
<div class="flr">copyright ©</div>
</div>
</form>
</body>
</html>
-----web.xml------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<servlet>
<servlet-name>indexServlet</servlet-name>
<servlet-class>org.imooc.servlet.IndexServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>indexServlet</servlet-name>
<url-pattern>/index</url-pattern>
</servlet-mapping>
</web-app>
------InsexServlet.java------
package org.imooc.servlet;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class IndexServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
this.doPost(req, resp);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
req.getRequestDispatcher("/WEB-INF/jsp/index.jsp").forward(req,resp);
}
}0
收起
正在回答 回答被采纳积分+1
1回答
从网页搭建入门Java Web2018版
- 参与学习 人
- 提交作业 1088 份
- 解答问题 10204 个
如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星