页面中文传参
1。后台处理端
String cname = request.getParameter("cname");System.out.println(cname);if(request.getMethod().equals("GET")){try {if(cname!=""&&cname!=null){cname=new String(cname.getBytes("ISO-8859-1"),"utf-8");System.out.println(cname);cname = URLDecoder.decode(cname,"utf-8");System.out.println(cname);} } catch (UnsupportedEncodingException e) {e.printStackTrace(); }}else{request.setAttribute("post","true");}// model.put("cname", cname);
<%String cname = (String)request.getParameter("cname");System.out.println("1:"+cname);String cname2 ="";if(cname!=null){if(request.getAttribute("post")!="true"){cname=new String(cname.getBytes("ISO-8859-1"),"utf-8");System.out.println("2:"+cname);}cname2 = URLEncoder.encode(cname,"utf-8");}elsecname=""; %>//<label for="cname">客户名称</label><input type="text" name="cname" id="cname" value="<%=cname%>" />//<div><a href="<%=basePath%>crm/customer/list.htm?index=1&cregion=${model.cregion}&cnature=${model.cnature}&cname=<%=cname2%>">首页</a><a href="<%=basePath%>crm/customer/list.htm?index=${model.pagination.pageIndex-1}&cregion=${model.cregion}&cnature=${model.cnature}&cname=<%=cname2%>">上一页</a><a href="<%=basePath%>crm/customer/list.htm?index=${model.pagination.pageIndex+1}&cregion=${model.cregion}&cnature=${model.cnature}&cname=<%=cname2%>">下一页</a><a href="<%=basePath%>crm/customer/list.htm?index=${model.pagination.pageCount}&cregion=${model.cregion}&cnature=${model.cnature}&cname=<%=cname2%>">尾页</a></div>