Java高级项目实战05:CRM系统搭建下集

接上集:《Java高级项目实战04:CRM系统搭建上集》

springmvc 配置文件servlet-context.xml配置文件添加



    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation=" 
        http://www.springframework.org/schema/mvc 
        http://www.springframework.org/schema/mvc/spring-mvc.xsd 
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans.xsd 
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/aop 
        http://www.springframework.org/schema/aop/spring-aop.xsd
        http://www.springframework.org/schema/tx 
        http://www.springframework.org/schema/tx/spring-tx.xsd">
    
    package="com.shsxt" />
    class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
        
        
    
    <bean
        class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
        
        
        
    

    
    
        

            
            class="org.springframework.http.converter.StringHttpMessageConverter">
            
            <bean
                class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
        


    
    
    
    
    
    
    
     

 

web.xml 修改


 
xmlns="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_3_0.xsd" id="WebApp_ID" version="3.0">
  
    contextConfigLocation
    classpath:spring.xml
  
  
    class>org.springframework.web.context.ContextLoaderListenerclass>
  
  
    char encoding filter
    encodingFilter
    class>org.springframework.web.filter.CharacterEncodingFilterclass>
    
      encoding
      UTF-8
    
  
  
    encodingFilter
    /*
  
  
    springMvc
    org.springframework.web.servlet.DispatcherServlet
    
      contextConfigLocation
      classpath:servlet-context.xml
    
    1
  
  
    springMvc
    /
  

 

前端静态文件添加(imgs,css,js等文件)

首页请求转发IndexController 编写

package com.shsxt.crm.controller;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.shsxt.base.BaseController;
import com.shsxt.base.util.LoginUserUtil;
import com.shsxt.crm.po.User;
import com.shsxt.crm.service.UserService;
@Controller
public class IndexController extends BaseController{
    @RequestMapping("index")
    public String index(){
        return "index";
    }
}

 

在视图文件夹views下添加登录页模板文件index.ftl,主页面main.ftl

部署项目并访问: http://localhost:8080/crm/index

Java高级项目实战05:CRM系统搭建下集_第1张图片

部署项目并访问: 

Java高级项目实战05:CRM系统搭建下集_第2张图片

你可能感兴趣的:(Java高级项目实战05:CRM系统搭建下集)