jsp 使用request为页面添加静态数据的实例(jsp使用js定义的变量)奔走相告

随心笔谈1年前 (2023)发布 admin
108 0


public static ArrayList<String> list;
static{
list=new ArrayList<String>();
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
   public static ArrayList<String> listdc;
static{
listdc=new ArrayList<String>();
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
listdc.add(“dcrewrwe3eeeeeeeeeeeeeeeee”);
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding(“UTF-8”);
response.setContentType(“text/html”);
ArrayList<String>list=getData();

request.setAttribute(“new”, list);
request.setAttribute(“dc”, listdc);
request.getRequestDispatcher(“/page/default.jsp”).forward(request, response);
}

© 版权声明

相关文章