• Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing from a delcaration  RSS feed

 
Kean Erickson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic somewhat addressed what I am curious about:

http://www.coderanch.com/t/279827/JSP/java/cant-out-println-inside-method

Obviously there's no access to the service method's "out" property in a declaration, but I'm unsure of the solution here.

"The myMethod method cannot see it unless it gets passed as a parameter....
If the out variable was defined as an instance variable, both methods would be able to see it"

Soooooo... I'm supposed to make my own outputstream to replace "out"? Pass what to what? (Don't worry, this is for testing purposes only, not actual use.)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll note that that post is about 9 years old. The world has moved on. In modern JSP there should be no Java code at all. No scriptlets.No declarations. All Java code should be placed into Java classes.
 
Kean Erickson
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like I said, this is for debugging purposes.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Doesn't really matter what the purpose is.

In any case, when the method declared by a declaration is called, it should be passed anything that it needs. Because the method is declared at class level, it has no access to the implicit variables declared in the service method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!