0

hello i am trying the following code

<%@ page import="java.util.*" %>
<HTML>
<BODY>
<%!
    Date theDate = new Date();
    Date getDate()
    {
        System.out.println( "In getDate() method" );
        return theDate;
    }
%>
Hello!  The time is now <%= getDate() %>
</BODY>
</HTML>

its so simple, taken from a tutorial. the question is, why the thing written inside system.out.printlen not being shown?
in java it shows as output what about jsp. where does system.out.println write in jsp?

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by peter_budo
0

The " System.out.println() " writes to the standard output, which in your case is the server. If you check the server you will see it written.

But this:

Hello!  The time is now <%= getDate() %>

is displayed at the page/browser and the: <%= getDate() %> is replaced by whatever the method returns. In your case the method returns this:

return theDate;

So this:
System.out.println() is written at the server
and this: <%= getDate() %> meaning this: return theDate; at the browser

0

are there any place for good exercises in jsp?

I already am very good programmer. hopwever jsp is new to me.
so i dont want hello world exercises, rather tough exercises to get started in jsp well.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.