当前位置:首页 > 开发 > 行业应用 > 正文

controller 基于字符串乱码问题解决

发表于: 2014-07-02   作者:小简   来源:转载   浏览:
摘要: 1.后台获取数据乱码问题 String formDataStr = StringUtils.isEmpty(req.getParameter("formData"))?"":req.getParameter("formData"); formDataStr=new String(formDataStr.getByte
1.后台获取数据乱码问题
 String formDataStr = StringUtils.isEmpty(req.getParameter("formData"))?"":req.getParameter("formData");

  formDataStr=new String(formDataStr.getBytes("iso-8859-1"),"utf-8");
 

2.SpringMVC controller层 前台乱码问题
@RequestMapping(value = "/getPurchaseContractResult", produces ={"application/text;charset=UTF-8"})
@ResponseBody
	public String itemlList(HttpServletRequest req, Model model) throws ManagerException {
		String purchaseOrderNo = req.getParameter("purchaseOrderNo");
		Map<String, Object> _map = new HashMap<String, Object>();
		_map.put("purchaseOrderNo", purchaseOrderNo);
		PurchaseOrderDtl p = new PurchaseOrderDtl();
		p.setPurchaseOrderNo(purchaseOrderNo);
		List<PurchaseOrderDtlDto> purchaseOrderDtl = this.purchaseOrderDtlManager.findByNo(_map);
		return purchaseOrderDtlManager.changeToDatagridList(purchaseOrderDtl);
	}

controller 基于字符串乱码问题解决

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

推荐文章
编辑推荐
版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号