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?

Recommended Answers

All 3 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.