参考:http://sishuok.com/forum/posts/list/7981.html ; http://www.tuicool.com/articles/6nqeIbm
用下面的这种方式,不需要启动tomcat服务器。
由于不好的叙述,在这就只是简单的描述了。
首先实体类User:
public class User {
private int id;
private String name;
private int age;
private String email;
......get、set、toString方法省略.....
}
UserController的代码如下:
import java.io.UnsupportedEncodingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.