Spring3 MVC Restful 多请求类型(json,xml,k-v),多视图配置(Json,Xml,JSP,Freemarker,Volacity等)

阅读更多
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  
   
   
   
   
   
   
       
   


   
   
   
   
       
           
               
               
               
               
                   
                       
                          
                              
                          
                        
                           true
                          
                          
                              
                                   com.xxx.XxxxDTO
                              

                          
                        
                       

                   

               
 
               
               
               
               
               
               
           

       

   
    
     
   
     
     
     
         
              UTF-8
         

     

     
       
         
       

     

   
   

   
   
       
   
       
       
           
               
               
               
           

       

       
           
               
                 
                 
                 
                 
                 
               

               
               
                   
                   
                   
               


                                       
           
       
       
           
               
               
               


               
               
                   
                                                 
                           
                       

                   

                                       
               
                
           

       

   


        
       
       
           
       

   



Controller类:
@Controller
@RequestMapping("/register/person")
public class PersonController {

    @RequestMapping(method=RequestMethod.GET)
    public ModelAndView list() {
   
        HashMap model = new HashMap();
        model.put("pager", pager); 
        return new ModelAndView("/register/person/personList",model );
    }
}

请求路径:  http://localhost:8080/MyProject/register/person
前台代码:
  ajax:
  jQuery.ajax({
       url: '/register/person',
       contentType: "application/json",//application/xml
       processData: true,//contentType为xml时,些值为false
       dataType: "html",//json--返回json数据类型;xml--返回xml
       data: {},
       success: function(data) { 
              },            
       error:function(e){
    }
  });

你可能感兴趣的:(XML,json,freemarker,JSP,MVC)