ssm项目中配置文件没错,启动项目报404,控制台也不报错,

这是applicationContext.xml文件

<?xml version="1.0" encoding="UTF-8"?>



<context:property-placeholder location=“classpath:database.properties”/>




















<!-- mapper工厂 为接口创建对象 -->
<bean id="factoryMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
      <property name="mapperInterface" value="cn.dao.UserMapper"></property>
      <property name="sqlSessionFactory" ref="sqlSessionFactory"></property>
</bean> 



<!-- service -->
<!-- <bean id="userService" class="cn.service.impl.StudentServiceImpl" p:usermapper-ref="factoryMapper">
</bean> -->

dispatcherServlet-servlert.xml文件

<?xml version="1.0" encoding="UTF-8"?>

mvc:annotation-driven/

<context:component-scan base-package=“cn”></context:component-scan>

<mvc:resources location="/statics/" mapping="/statics/**"></mvc:resources>


 <!-- 出现异常后的处理页面 -->
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
     <property name="exceptionMappings">
        <props>
           <prop key="java.lang.Exception">error</prop>
        </props>
     </property>
</bean> 
  <!-- 配置拦截上传内容 -->
<!-- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
   <property name="maxUploadSize" value="10000000"></property>  
</bean>-->

web.xml文件

<?xml version="1.0" encoding="UTF-8"?>


org.springframework.web.context.ContextLoaderListener contextConfigLocation classpath:applicationContext.xml springmvc org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:dispatcherServlet-servlet.xml 1 springmvc / encoding org.springframework.web.filter.CharacterEncodingFilter encoding UTF-8 encoding /* loginUser.jsp

在这里插入图片描述
controller文件
package cn.controller;

import cn.entity.User;
import cn.service.*;
import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserController {

@Resource
private UserService userService;

@ResponseBody
@RequestMapping(value="/loginUser",method=RequestMethod.POST)
public String loginUser(User user) {
	User u = userService.loginUser(user);
	String mess="error";
	mess=u==null?mess:"ok";
	return mess;
}

}

loginUser.jsp页面
<%@ page language=“java” contentType=“text/html; charset=UTF-8”
pageEncoding=“UTF-8”%>

Insert title here

用户名:

密码:

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值