xml配置
注解配置
常见注解
@Autowired
@Resource
@Qulifer
@Component
@Service
@Repository
@Controller
@Controller
@ResponseBody
@RestController
@RequestMapping
@RequestParams
@RequestBody
web.xml配置
前端控制器
DispatcherServlet
post乱码解决
常见的功能
上传文件
日期格式转换
get,post乱码解决
post请求参数和响应乱码解决方案:
在web.xml中配置filter:
CharactorEncodingFilter
get请求参数和响应乱码解决:
在tomcat中修改默认配置, 改成
uriencoding="utf-8"
另外一种方式是对参数重新编码:
getParamter("userName").getBytes("iso-8859-1","utf-8");