springmvc5.38+Eclipse,搭建环境后报404,进不了Controller

刚开始学java,碰到404,卡了1天了,求大佬指教。就SSM项目,没有用到maven和springboot

springmvc.xml配置

  <!-- 扫描controller包 -->
        <context:component-scan base-package="com.car.bus.controller"></context:component-scan>
        <context:component-scan base-package="com.car.sys.controller"></context:component-scan>
        
                <!-- 配置文件上上传 -->
        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="uft-8"></property>
        <property name="uploadTempDir" value="upload/temp"></property>
        <property name="maxUploadSize" value="20971520"></property>        
        </bean>
        <!-- 配置自动映射 -->
        <mvc:annotation-driven/>
               <!--  配置静态文件放行 -->
       <mvc:default-servlet-handler/>
        
        <!-- 配置视图类 -->
        <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/view/"></property>
        <property name="suffix" value=".jsp"></property>
        </bean>

web.xml配置

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">
  <display-name>car</display-name>
  
  
  <!-- 配置application-context加载监听器 -->
    <context-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:application-context.xml</param-value>
  </context-param>
  <listener>
  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>

  
  <!-- 编码过滤器设置 -->
  
  <filter>
  <filter-name>charset</filter-name>
  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  <init-param>
  <param-name>encoding</param-name>
  <param-value>UTF-8</param-value>
  </init-param>
  </filter>
    <!-- 编码过滤器映射 -->
  <filter-mapping>
  <filter-name>charset</filter-name>
  <servlet-name>springmvc</servlet-name>
  </filter-mapping>
  
  <!-- 配置前端控制器 -->
  <servlet>
  <servlet-name>springmvc</servlet-name>
  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  <init-param>
  <param-name>contextConfigLocation</param-name>
  <param-value>classpath:springmvc.xml</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
  </servlet>
  <!-- 配置前端控制器映射 -->
  <servlet-mapping>
  <servlet-name>springmvc</servlet-name>
  <url-pattern>*.action</url-pattern>
  </servlet-mapping>
  
  
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

controller内容

package com.car.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.car.sys.constast.SYS_CONSTAST;
import com.car.sys.domain.User;
import com.car.sys.service.UserService;
import com.car.sys.utils.WebUtils;
import com.car.sys.vo.UserVo;

@Controller
@RequestMapping("login")
public class LoginController {
    @Autowir

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值