为什么使用EL表达式却没有输出结果(JES是我的项目名):
servlet内容如下
package servlet;import  ghy_jstl.Student;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;public class Myservlet extends HttpServlet {


public Myservlet(){
super();
}
public void destroy(){
super.destroy();
} public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

String simple_string_username="gaohongyan";
request.setAttribute("simple_string_username", simple_string_username);

ArrayList al_simple_string =new ArrayList();
al_simple_string.add("simple_string1");
al_simple_string.add("simple_string2");
request.setAttribute("al_simple_string", al_simple_string);

response.sendRedirect("/JES/MyJsp.jsp");
}}
MyJsp.jsp内容如下:
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page isELIgnored="false" %>
<html>
  <body>
    simple_string_username value=${simple_string_username}
    <br>
    <br>
   al_simple_string[0]=${al_simple_string[0] }
   <br>
   al_simple_string[1]=${al_simple_string[1] }
  </body>
</html>
跪请高手指导:为什么没有输出结果:gaohongyan ,simple_string1,simple_string1

解决方案 »

  1.   

    你用的跳转页面的方法是重定向,
    此时的request对象里已没有存储任何东西
      

  2.   

    response.sendRedirect("/JES/MyJsp.jsp");你都redirect了,相当重新发起一次新的请求到这个页面,当然没数据改为:
    RequestDispatcher requestDispatcher = request.getRequestDispatcher("("/JES/MyJsp.jsp");
    requestDispatcher.forward(request, response);
      

  3.   

    al_simple_string.add("simple_string1");
    al_simple_string.add("simple_string2");你确定里面有值?