• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

out.println("") is not working in between declaration tags?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<HTML><BODY>
Hello 1 <B>
<%!
int i=10;
public void a()
{
i = i+10;
out.println("inside ");
}

%> </B>
Hello 1
<B><%
a();
out.print("first line "+i+6);
%></B>

</BODY></HTML>
---
above script is giving HTTP status 500 error at first out.println, why?
is it means in between <%! and %> can't we use implicit objects?.

In between declaration tags it is allowing to declare methods and call them self. But why it is not allowing to print.
 
Sumitro Palit
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right.
The implicit objects are declared inside the generated _jspService method.
You cannot use the implicit objects outside of the _jspservice scope (scriptlets.)

- ortimuS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic