<% String s2=request.getParameter("param"); out.println(s2);%> %> compiles fine and give the output of %> but if i write same code as <% <% String s2=request.getParameter("param"); out.println(s2);%> the output is org.apache.jasper.JasperException: Unable to compile class for JSPC:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fExpression_00031_0002ejspExpression1_jsp_31.java:141: Missing term. out.write(" \r\n"); ^ C:\jakarta-tomcat\work\localhost_8080%2Fexamples\_0002fjsp_0002fExpression_00031_0002ejspExpression1_jsp_31.java:144: Missing term. <% ^ 2 errors my question is why the container consider the n nos of %> at end of scriptlet as acceptable but not even 1 <% before scriptlet as acceptable can any one Pls clarify
SCJP,SCWCD,SCBCD<br />If Opportunity doesn't knock then build the door
Hi, This is quite simple. When the compiler encounters <% it excepts java code to follow but in case 2 of urs there is <% and naturally gives compilation error. Coming on to case 1 when the compiler encounters %> it concludes that scriptlet is over.. and anything that follows is text unless the next token is <% or directive or jsp actions..