由于调用Jquery的序列化方法时,jQuery会自动进行编码处理,因此后台使用前,应该先进行解码,然后再使用
// 使用 DynaBean dynaBean = (DynaBean) form; super.decodeCharacterForGetMethod(dynaBean, request); // 方法 public void decodeCharacterForGetMethod(Object object, HttpServletRequest request) throws Exception { if (!StringUtils.equalsIgnoreCase(request.getMethod(), "GET")) { return; } if (object instanceof DynaBean) { DynaBean dynaBean = (DynaBean) object; DynaProperty origDescriptors[] = dynaBean.getDynaClass().getDynaProperties(); for (int i = 0; i < origDescriptors.length; i++) { String name = origDescriptors[i].getName(); if (getBeanUtilsBean().getPropertyUtils().isWriteable(dynaBean, name)) { Object value = dynaBean.get(name); if (value instanceof String) { getBeanUtilsBean().copyProperty(dynaBean, name, URLDecoder.decode(value.toString(), "UTF-8")); } } } } else {// is a standard JavaBean PropertyDescriptor origDescriptors[] = getBeanUtilsBean().getPropertyUtils().getPropertyDescriptors(object); for (int i = 0; i < origDescriptors.length; i++) { String name = origDescriptors[i].getName(); if ("class".equals(name)) { continue; // No point in trying to set an object's class } if (getBeanUtilsBean().getPropertyUtils().isReadable(object, name) && getBeanUtilsBean().getPropertyUtils().isWriteable(object, name)) { Object value = getBeanUtilsBean().getPropertyUtils().getSimpleProperty(object, name); if (value instanceof String) { getBeanUtilsBean().copyProperty(object, name, URLDecoder.decode(value.toString(), "UTF-8")); } } } } } public BeanUtilsBean getBeanUtilsBean() { return BeanUtilsBean.getInstance(); }