Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

System.out.println in jsp

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , in my system "System.out.println" is not working . But i see this code .
<% System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
%>
Will system.out.println work in jsp or only out.println will work
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65228
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course it works. It's just not doing what you incorrectly expect. It writes the output to the console.

By the way, still putting Java code in JSPs? Not a good practice.
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But i have tried , System.out.println not working . only out.println works fine.
 
Prasad Krishnegowda
Ranch Hand
Posts: 671
4
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As, Bear pointed out, System.out.println will print in the console, means in the server logs, not in the resulting page, out.println, will print in the resulting page, so if you are sure, its not printing in the console, can you tell, are you getting any exception, or its just not working at all..
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i supposed to print value of a display page . while using out.println(a); means value of a printed in resulting page.
but system.out.println(a); means nothing displayed in resulting page
 
Eswar Nec
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Here i use the word S.O.P instead of System.out.println and O.P instead of output.println
If you have use Netbeans IDE, then easily identify the difference between S.O.P and O.P.


Netbeans IDE have output window. This window has some tabs including
1. Apache Tomcat(version) Log and
2. Apache Tomcat(version) . Version like 5.5 0r 6.018 anything.


The output of 5,6(line number) have displayed in second tab (netbeansIDE) like Apache Tomcat 6.0.18
Otherwise You can see apache tomcat server log file --> (System.out.println content).

Then Output of 9,10(line number) have displayed in browser window. --> (output.println content)

If you want any thing displayed in browser, better you will use output.println().
 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you give reason for why system.out.println not displayed in browser window
 
Eswar Nec
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajendra Prakash wrote:can you give reason for why system.out.println not displayed in browser window


You refer this link .
http://www.java-forums.org/advanced-java/12575-difference-between-system-out-println-out-println.html

I think you will get some idea about this

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ItDoesntWorkIsUseless. Next time, try to explain your problems more specifically. After reading your first post, we have no idea that you want to print something in the browser page.
 
Eswar Nec
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:ItDoesntWorkIsUseless. Next time, try to explain your problems more specifically. After reading your first post, we have no idea that you want to print something in the browser page.


Hi,
I don't know. Which post you mention?

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Eswara: Christopher wasn't talking to you.

@Rajendra: Christopher *was* talking to you. Your question was answered several times, including in Bear's first response. System.out.println writes to the system console. That is *NOT* the same thing as the JSP page. IN a JSP, out.println *does* write to the JSP page, because "System.out" and "out" are two completely different variables, which you'd see if you printed either of them to the JSP. Or the system console. Using the appropriate variable.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David. Eswara, sorry for the confusion. I was referring to Rajendra's first post.
 
Eswar Nec
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christophe Verré wrote:Thanks David. Eswara, sorry for the confusion. I was referring to Rajendra's first post.


Thanks for your reply. Cool
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic