Action配置
package com.jlc.action;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.jlc.base.action.BaseAction;
import com.jlc.bean.User;
@Controller
@RequestMapping(value="/user")
public class UserAction extends BaseAction{
@RequestMapping(value="/login",method=RequestMethod.GET)
public String login(){
return "user/success";
}
@RequestMapping(value="/json",method=RequestMethod.GET)
public @ResponseBody List<User> test(){
List<User> userList = new ArrayList<User>();
User user = new User();
user.setId(1L);
user.setName("name1");
user.setPassword("中文");
userList.add(user);
user = new User();
user.setId(2L);
user.setName("name2");
user.setPassword("password");
userList.add(user);
user = new User();
user.setId(3L);
user.setName("name3");
user.setPassword("password");
userList.add(user);
return userList;javascript:;
}
}
中文显示没问题
下载地址:https://code.google.com/p/searchengineone/downloads/list
?
?