jsp定义一个全局数组变量,多个都可获取其值改变其值
jsp定义一个全局数组变量,多个都可获取其值改变其值
在shuzu.jsp中定义数组
<%
String wj[][]=new String[50][50];
%>
在formx11.jsp中引用赋值
<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*,java.util.*"%>
<%@include file="shuzu.jsp"%>
<jsp:useBean id="connBean" scope="page" class="wjdc.DBHandle"/>
<head>
<title>问卷调查生成</title>
</head>
<%
request.setCharacterEncoding("GBK");
String wjbt=request.getParameter("bt");
String wjnr=request.getParameter("nr");
String wjts=request.getParameter("num");
wj[1][0]=wjbt;
wj[1][1]=wjnr;
wj[1][2]=wjts;
。。。
在formx2.jsp中要读取数组值
<%@page contentType="text/html;charset=GBK"%>
<%@page import="java.io.*"%>
<%@page import="java.sql.*,java.util.*"%>
<%@include file="shuzu.jsp"%>
<jsp:useBean id="connBean" scope="page" class="wjdc.DBHandle"/>
。。。
out.println("abc"+wj[1][0]);
out.println(wj[1][1]);
out.println(wj[1][2]);
。。。
可是读出的是null
我是新手,请大师指点