• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I child proofed my house but they still get in. Distract them with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic