Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: System.out.println Not Working

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default System.out.println Not Working

    Hai,

    System.out.println does not print any output in browser.Can anyone pls tell me what is the problem?Thanks in Advance


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,719
    Thanks
    45
    Thanked 1,974 Times in 1,948 Posts

    Default Re: System.out.println Not Working

    If you are calling S.o.p from an applet, the print out will be in the java console.
    If not, please explain how you are executing the program.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: System.out.println Not Working

    Hai Norm,
    Thanks for u r rply.Iam calling S.o.p from JSP.Its not printing output on Browser.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    18,719
    Thanks
    45
    Thanked 1,974 Times in 1,948 Posts

    Default Re: System.out.println Not Working

    Where does the JSP code execute?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Super Moderator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,104
    Thanks
    169
    Thanked 780 Times in 726 Posts
    Blog Entries
    5

    Default Re: System.out.println Not Working

    System.out.println does not print to the browser, it prints to the console. To print the output so that the browser can parse the data, use the JSP variable out (eg out.println('Hello world') )

    Edit: moved to http://www.javaprogrammingforums.com...ages-jsp-jstl/ In the future, please select your post forum carefully, and please include more information regarding what you are doing.
    Last edited by copeg; June 23rd, 2012 at 10:56 AM.

  6. #6
    Member vigneshwaran's Avatar
    Join Date
    Nov 2012
    Location
    Chennai, TamilNadu
    Posts
    35
    My Mood
    Cheerful
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Re: System.out.println Not Working

    Create a variable(instance) for the class PrintWriter
    like
    public void doGet(HttpRequest request, HttpResponse response) throws ServletException,IOException
    {
    request.setContentType("text/html");
    PrintWriter out=response.getWriter();
    out.println("Hello world");
    }

  7. #7
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: System.out.println Not Working

    Quote Originally Posted by vigneshwaran View Post
    Create a variable(instance) for the class PrintWriter
    like
    public void doGet(HttpRequest request, HttpResponse response) throws ServletException,IOException
    {
    request.setContentType("text/html");
    PrintWriter out=response.getWriter();
    out.println("Hello world");
    }
    JSP CODE != Servlet CODE
    Anyone who stops learning is old, whether at twenty or eighty. Anyone who keeps learning stays young. The greatest thing in life is to keep your mind young.

    - Henry Ford

Similar Threads

  1. System.out.println("Message");
    By Java Programmer in forum What's Wrong With My Code?
    Replies: 15
    Last Post: March 28th, 2012, 09:28 PM
  2. use of System.out.println(""); error....
    By rohan22 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 16th, 2011, 10:49 AM
  3. How to modify System.out.println()
    By emailkia in forum Java Theory & Questions
    Replies: 6
    Last Post: April 25th, 2011, 12:40 AM
  4. what is System,out,println in System.out.println()?
    By koteshk in forum Java Theory & Questions
    Replies: 2
    Last Post: April 18th, 2011, 12:28 AM
  5. How can i print rows 1 by 1 using System.out.println?
    By noFear in forum Java Theory & Questions
    Replies: 2
    Last Post: August 26th, 2010, 07:35 AM