String currentPage = request.getAttribute("currentPage").toString();//这个值已经获取到了
${requestScope.currentPage} //我却得不到值??? 为什么或者说还有其它方法告诉我 谢谢

解决方案 »

  1.   

    String currentPage 你设为全局变量就可以了
      

  2.   


    跟这个有关系吗?? 我现在就像拿到currentPage值。 ${requestScope.currentPage}这种方法取不到?
      

  3.   


    试过了 ,不行。jsp页面直接把${currentPage}打印出来了
      

  4.   

    先确定用的Servlet / JSP的版本。查看web.xml的开头部分,如果有以下内容,表示是Servlet 2.4 / JSP 2.0。
    <web-app version="2.4"
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">在默认情况下,Servlet 2.4 / JSP 2.0支持。如果是别的版本下,将用到EL 表达式的 JSP页面的开头添加如下一句代码即可。
    <%@ page isELIgnored="false" %> (这个我试过有用)
    另外的 看参考资料,资料里面有的方法我试了没什么效果,仅仅参考参考资料:http://www.javaeye.com/topic/231840 http://www.javaeye.com/topic/155354 
      

  5.   


    如果用struts2怎么表达???EL表达式的包我加不上。
      

  6.   

    在JSP头添加 <%@page  isELIgnored = "false" %>  
      

  7.   

    request  你要确定是一个值才可以取得,如果不是同一个request,肯定是取不到的。
      

  8.   

    直接用<c:out value="{currentPage}" />,记得要导入jstl
      

  9.   

    是不是请求跳转了,所以request丢失了。
      

  10.   

    ${currentPage }这样就可以取到值啊!作用域吗!呵呵
      

  11.   

    楼主啊,我却是取到值了。看一看我的代码吧。protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String currentPage="currentPage";
    request.setAttribute("currentPage",currentPage);
    request.getRequestDispatcher("/requestJsp.jsp").forward(request, response);
    }<%String currentPage=request.getAttribute("currentPage").toString(); %>
    <%=currentPage %>
       ${currentPage}
       ${requestScope.currentPage }
    结果:currentPage currentPage currentPage 
    看我的结果都出来了,你的结果让我困扰了。
      

  12.   

    LZ不是忘记引入struts的标签库了吧