facebook

jsp editor error for if-else tag-syntax error on token

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #247226 Reply

    I have the following valid jsp file. But jsp editor shows error for “else” tag as syntax error on token “else”, delete this token.

    Please advise me how to disable this error without modifying the code.

    environment: myeclipse 4.0 and eclipse 3.1 and tomcat 5.5.12.
    ————————-

    <%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
    %>

    <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
    <html>
    <head>
    <base href=”<%=basePath%>”>

    <title>My JSP ‘MyJsp.jsp’ starting page</title>

    <meta http-equiv=”pragma” content=”no-cache”>
    <meta http-equiv=”cache-control” content=”no-cache”>
    <meta http-equiv=”expires” content=”0″>
    <meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
    <meta http-equiv=”description” content=”This is my page”>

    <!–
    <link rel=”stylesheet” type=”text/css” href=”styles.css”>
    –>
    </head>

    <body>
    <%

    int i=0;
    i++;
    System.out.println(“i is “+i);

    %>
    <%if(i==1) %>
    Active
    <%else if(i==3) %>
    Pending
    <%else %>
    Inactive
    This is my JSP page. <br>
    </body>
    </html>

    #247228 Reply

    Riyad Kalla
    Member

    You need to use braces:

    
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'MyJsp.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
    </head>
    
    <body>
    <%
    
    int i=0;
    i++;
    System.out.println("i is "+i);
    
    
    
    %>
    <%if(i==1){ %>
    Active
    <%}else if(i==3){ %>
    Pending
    <%}else{ %>
    Inactive
    <%}%>
    This is my JSP page. <br>
    </body>
    </html>
    

    We do recognize that this is valid code however and I will file the issue.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: jsp editor error for if-else tag-syntax error on token

You must be logged in to post in the forum log in