0
回答
请教spring mvc的问题,你不知道的事
终于搞明白,存储TCO原来是这样算的>>>   
@RequestMapping(value = "showXml") 
@ResponseBody 
public UserDto showXml(String name) { 
logger.debug("name:"+name); 

UserDto userDto1=new UserDto(1,name,22); 

return userDto1; 
} 

这样能成功返回一个UserDto 序列化的xml字符串

若:
@RequestMapping(value = "showXml") 
@ResponseBody 
public List<UserDto> showXml(String name) { 

logger.debug("name:"+name); 

UserDto userDto1=new UserDto(1,name,22); 
UserDto userDto2=new UserDto(2,name+"2",22); 

List<UserDto> userDtoList=new ArrayList<UserDto>(); 
userDtoList.add(userDto1); 
userDtoList.add(userDto2); 

return userDtoList; 
} 

若返回一个list的UserDto却不能

请高人赐教

举报
Macrotea
发帖于6年前 0回/230阅
顶部