servlet参数传递及页面跳转

您所在的位置:网站首页 servlet转发jsp页面 servlet参数传递及页面跳转

servlet参数传递及页面跳转

2023-09-13 13:23| 来源: 网络整理| 查看: 265

servlet参数传递及页面跳转

这里包括servlet接受参数、传递参数、参数乱码、页面乱码、页面跳转、用户信息保存至session等

一、接受参数 1、接收单个字符串

这里直接写解决乱码的接受方式 String name = new String(request.getParameter(“name”).getBytes(“ISO-8859-1”), “UTF-8”);

2、接受js传递过来的数组

String[] conducts=request.getParameterValues(“conducts”); 接受js的数组含有,,,, 可以用split函数分割

String[] conducts=request.getParameterValues("conducts"); String[] strings = conducts[0].split(",,,,"); for (String string : strings) { System.out.println("pic:"+string); } if("".equals(strings[1])){ String[] s = new String[strings.length-1]; for(int i=0;i


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3