我写了一个页面,功能是根据用户是否已经登陆,来判断是否他可以回复,提示说无法编译该JSP页面,请各位大侠指点一下~谢谢
出问题的代码段:(其中的chat.jsp页面,是填写和提交回复信息的页面)
    <%
     String una1=null;
     Cookie[] cookies1=request.getCookies();
  for(int i=0;i<cookies1.length;i++){
    Cookie temp=cookies1[i];
     if("un".equals(temp.getName())){
     una1=temp.getValue();
     }
     if(una1!=null){
         %>
     <jsp:include flush="true" page="chat.jsp?tid=<%=tid %>"></jsp:include>
     <%
    }else{
     %>
   <h5><font color="red">您尚未登陆无法发表评论。</font></h5>
     <%
    }
    %>

解决方案 »

  1.   

    <%=tid %>
    你的tid是在那里定义的???
    tid=una1???
      

  2.   

    tid是在loginAcion中加如到一个cookie,cookie和生命周期同session因为我没设置它的sexMaxAge();tid是我在上一个页面定义的~通过传进来的参数来分辨是哪个帖子的~
      

  3.   

    出错的这段代码如果的屏蔽的话,只保留<jsp:include flush="true" page="chat.jsp?tid=<%=tid %>"></jsp:include>是可以正常运行的~我是想通过COOKIE的验证来判断用户是否登陆,从而判断他是否可以回帖
      

  4.   

    for(int i=0;i<cookies1.length;i++){
       Cookie temp=cookies1[i];
        if("un".equals(temp.getName())){
        una1=temp.getValue();
        }你少了一个关闭for循环的}
      

  5.   

    建议你使用重定向,应该就没问题了,如  response.sendRedirect("chat.jsp?tid=<%=tid %>");
      return;
      

  6.   

    谢谢 bruni(不如你) 
    我确实是少了一个 } 实在是太大意了
      

  7.   

    ;-)
    用eclipse或者netbeans之类的工具 这类问题就不太会发生了