首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

页面汉语传参

2012-10-06 
页面中文传参1。后台处理端String cname request.getParameter(cname)System.out.println(cname)if(r

页面中文传参
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);


2.页面中要有的

<%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>


热点排行