It will be ok if you do like this. I tested it already.
<% if(true){ %>
<%= "I am fine" %>
<% } else {%>
<%= "You are fine" %>
<%}%>
if you use your code:
<% if(true)%>
<%= "I am fine" %>
<% else %>
<%= "You are fine" %>
The JSP will be translated to following
java code, it will not be compiled sucessfully.I think that is because extra code are added by JSP container during translation . So if we use "{" and "}", It will works.
if(true)
out.write("\r\n");
out.print( "I am fine" );
out.write("\r\n");
else
out.write("\r\n");
out.print( "You are fine" );
the error message is :'else' without 'if'.
else
^
[This message has been edited by Win Yu (edited November 21, 2001).]
[This message has been edited by Win Yu (edited November 22, 2001).]