老师我这个就是按照视频做的为什么我这个访问不到页面呢

老师我这个就是按照视频做的为什么我这个访问不到页面呢

----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 &copy;</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);
    }
}


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕阿满 2018-12-10 13:51:59

同学你好,试了一下同学的代码,可以正常运行。同学运行报错了吗?建议同学按12,将错误信息贴上来,方便我们帮你查看具体问题。祝:学习愉快~

  • 提问者 慕少315640 #1
    老师您可以正常运行,但是我就不可以正常运行,而且我这个页面没有报错,空白页面
    2018-12-10 15:24:27
  • 好帮手慕阿满 回复 提问者 慕少315640 #2
    看到同学之后在问启动项目的问题,同学是否是没有启动项目,现在可以正常运行了吗?祝:学习愉快~
    2018-12-10 16:56:18
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
从网页搭建入门Java Web2018版
  • 参与学习           人
  • 提交作业       1088    份
  • 解答问题       10205    个

如果你有Java语言基础,又想以后从事Java Web开发,那么本路径是你的不二选择!本路径从网页搭建开始入手,通过大量案例来学习Java Web基础。定能助你完成Java Web小白的蜕变!

了解课程
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师