<%@ page import="java.util.*"%>
<%
if(  ${applicationScope.pagenum} == null){   
application.setAttribute("pagenum",new Integer(0));
}
%>
<%
Integer num=(Integer)application.getAttribute("pagenum");
application.setAttribute("pagenum",new Integer(num.intValue()+1));
%>
<body>
<%=application.getAttribute("pagenum")%>
</body>这里 IF判断貌似有问题刚上完 表达式的课  不清楚是否可以这样用。。

解决方案 »

  1.   

    if(  ${applicationScope.pagenum} == null){  改为如果applicationScope放在request的属性里的话if( request.getAttribute("applicationScope").getPagenum() == null){  
      

  2.   

    这个我知道不过学了 el感觉 这里 如果可以用 if(  ${applicationScope.pagenum} == null) 就完美了。。
    有知道原因的伐?
      

  3.   

    这个我知道不过学了 el感觉 这里 如果可以用 if(  ${applicationScope.pagenum} == null) 就完美了。。
    有知道原因的伐?
      

  4.   

    貌似楼上理解错误了applicationScope  EL的隐式对象吧。。  而且是application范围如果加 request的话范围就变了。。  按你的意思是  应该写成
    if( application.getAttribute("pagenum") == null){  
    这样吧。。
      

  5.   

    if(${applicationScope.pagenum} == null) 改为:if(application.getAttribute("pagenum") == null) 就可以了。楼主也可以采用 JSTL,看上去更为简洁一些,全部代码如下:先导入 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %><c:if test="${empty applicationScope.pagenum}">
      <c:set var="pagenum" value="0" scope="application" />
    </c:if>
    <c:set var="pagenum" value="${applicationScope.pagenum + 1}" scope="application" />
    <c:out value="${applicationScope.pagenum + 1}" />
    只要把 %TOMCAT_HOME%/webapps/examples/WEB-INF/lib(Tomcat 6.x)、%TOMCAT_HOME%/webapps/jsp-examples/WEB-INF/lib(Tomcat 5.x)下的 jstl.jar、standard.jar 复制到你工程的 WEB-INF/lib 下就可以用了。
      

  6.   

    E....标签目前还没学到...不过还是谢谢LS