springmvc 配置文件servlet-context.xml配置文件添加
class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
web.xml 修改
contextConfigLocation
classpath:spring.xml
org.springframework.web.context.ContextLoaderListener
char encoding filter
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
encodingFilter
/*
springMvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:servlet-context.xml
1
springMvc
/
前端静态文件添加(imgs,css,js等文件)
首页请求转发IndexController 编写
packagecom.shsxt.crm.controller;importjavax.annotation.Resource;importjavax.servlet.http.HttpServletRequest;importorg.springframework.stereotype.Controller;importorg.springframework.web.bind.annotation.RequestMapping;importorg.springframework.web.servlet.ModelAndView;importcom.shsxt.base.BaseController;importcom.shsxt.base.util.LoginUserUtil;importcom.shsxt.crm.po.User;importcom.shsxt.crm.service.UserService;
@Controllerpublic class IndexController extendsBaseController{
@RequestMapping("index")publicString index(){return "index";
}
}
在视图文件夹views下添加登录页模板文件index.ftl,主页面main.ftl