RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
Maven-SpringMVC-创新互联

Maven-SpringMVC

创新互联于2013年创立,先为广阳等服务建站,广阳等地企业,进行企业商务咨询服务。为广阳企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
1.创建maven工程

2.在pom.xml文件中添加依赖项


    4.3.9.RELEASE



    
    
        org.springframework
        spring-webmvc
        ${springframe.version}
    

    
    
        jstl
        jstl
        1.2
    

    
        javax.servlet
        javax.servlet-api
        3.0.1
        
        provided
    

    

    
        com.fasterxml.jackson.core
        jackson-databind
        2.9.1
    



    3.创建文件 spring-mvc.xml
        

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.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-4.3.xsd">







    
    

4.配置web.xml , 加载 spring-mvc.xml
        
    SpringMVC
    org.springframework.web.servlet.DispatcherServlet
    
        contextConfigLocation
        classpath:spring-mvc.xml
    


    SpringMVC
    /




    encodingFilter
    org.springframework.web.filter.CharacterEncodingFilter
    
        encoding
        UTF-8
    
    
        forceEncoding
        true
    


    encodingFilter
    /*


    5.创建控制层代码 IndexController.java
        @Controller

@RequestMapping("/")
public class IndexController {

@RequestMapping("index")
    public String index(){
            System.out.println("index");
            return "index";
    }
}
在地址栏输入http://localhost:8080/工程名/index就可访问index.jsp

创新互联www.cdcxhl.cn,专业提供香港、美国云服务器,动态BGP最优骨干路由自动选择,持续稳定高效的网络助力业务部署。公司持有工信部办法的idc、isp许可证, 机房独有T级流量清洗系统配攻击溯源,准确进行流量调度,确保服务器高可用性。佳节活动现已开启,新人活动云服务器买多久送多久。


分享名称:Maven-SpringMVC-创新互联
本文链接:http://cqwzjz.cn/article/hjsig.html