Icce___ 2016-03-16 06:19 采纳率: 66.7%
浏览 1512
已结题

spring tomcat网站首页问题

最近学习spring,在网上找了一个简单登陆的DEMO,弄好后文件路径是这样的图片说明

WEB.XML里的内容如下:

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
  id="WebApp_ID" version="2.5">
  <display-name>SpringDemo</display-name>
  <context-param>
    <param-name>webAppRootKey</param-name>
    <param-value>SpringDemo.webapp.root</param-value>
  </context-param>

  <!-- 指定log4j配置文件的位置 -->
  <!-- WebApplicationContext需要使用日志功能,放在Spring配置的前面 -->
  <context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>classpath:log4j.xml</param-value>
  </context-param>

  <!--  -->
  <context-param>
    <param-name>log4fRefreshInterval</param-name>
    <param-value>60000</param-value>
  </context-param>

  <!-- 指定Spring配置文件 -->
  <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
  </context-param>

  <!-- 定义Web容器监听器,监听器负责完成IoC容器在Web环境中的启动工作 -->
  <!-- IoC容器启动过程就是建立上下文的过程 -->
  <!-- ContextLoaderListener启动的上下文为根上下文 -->
  <!-- ContextLoaderListener实现了ServletContextListener接口 -->
  <!-- ContextLoaderListener->ContextLoader:1,载入IoC容器到Web容器;2,实例化WebApplicationContext -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  <!-- 配置log4j的监听器 -->
  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener>

  <!-- DispatcherServlet起着分发请求的作用,Spring MVC的核心 -->
  <!-- ContextLoaderListener初始化完成后,Web容器开始初始化DispatcherServlet -->
  <servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <init-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/dispatcherServlet.xml</param-value>
    </init-param>
  </servlet>

  <!-- 指定需要处理的http请求 -->
  <servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>/WEB-INF/views/login.jsp</welcome-file>
  </welcome-file-list>
</web-app>

现在网页输入localhost:8080/bysj 能到index.jsp,我要怎么样才能让他直接到login.jsp呢?应该在哪里配置?还有可以直接localhost:8080就进入首页吗?
刚刚学习所以不太懂,好心人帮帮忙啊~~~~~急急急~~~~

  • 写回答

7条回答

  • 夜半无声 2016-03-16 06:24
    关注
     <welcome-file-list>
        <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
    

    最底下就是配置你项目首页的!

    评论

报告相同问题?

悬赏问题

  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作