//获取所有的参数和取值:实际开发中应该把数据封装到JavaBean中.非常简单,借助于BeanUtils框架
private void test6(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
User user = new User();
System.out.println("封装前:"+user);
try {
BeanUtils.populate(user, request.getParameterMap());//实现原理就是test5.编写代码是,保持表单输入域与JavaBean的属性一致即可
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("封装后:"+user);
}