- This topic has 1 reply, 2 voices, and was last updated 19 years, 2 months ago by
Riyad Kalla.
-
AuthorPosts
-
myeclipseuser1MemberI 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>
Riyad KallaMemberYou 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.
-
AuthorPosts