servlet中的数组传给jsp:传的是null
servlet:String[]s={"aa","bb"};int[]b={1,2};request.setAttribute("s1",s);request.setAt...
servlet:
String [] s = {"aa","bb"};
int [] b = {1,2};
request.setAttribute("s1",s);
request.setAttribute("b1",b);
request.getRequestDispatcher("cc.jsp").forward(request, response);
cc.jsp:
<%
String [] s1 = (String [])request.getAttribute("s1");
int [] b1 = (int [])request.getAttribute("b1");
System.out.println(s1+"~~~~"+b1);
%>
结果:null~~~~null
已经上网百度过了,csdn等其他论坛上都是说这样是可以的,可是为什么我的不行呢?!
求大神指教!!!! 展开
String [] s = {"aa","bb"};
int [] b = {1,2};
request.setAttribute("s1",s);
request.setAttribute("b1",b);
request.getRequestDispatcher("cc.jsp").forward(request, response);
cc.jsp:
<%
String [] s1 = (String [])request.getAttribute("s1");
int [] b1 = (int [])request.getAttribute("b1");
System.out.println(s1+"~~~~"+b1);
%>
结果:null~~~~null
已经上网百度过了,csdn等其他论坛上都是说这样是可以的,可是为什么我的不行呢?!
求大神指教!!!! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询