We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

new-b questions ....

meow00
meow00 asked
on
Medium Priority
249 Views
Last Modified: 2010-04-01
Hi Experts,

    I am trying to test a simple jsp file

<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<H1>JSP Test </H1>
Time: <% = new java.util.Date() %>
</body>
</html>

--------------------
but all I see from IE is :

JSP Test
Time:

-----------------------
 I must have missed some important part so that I can not see the time..... could anyone please give me some helps ? Thanks !

meow.
Comment
Watch Question

<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<H1>JSP Test </H1>
Time: <% = new java.util.Date().toLocaleString() %>
</body>
</html>

Author

Commented:
er .......... I still got the same result .......

..... is there anything else might need to be fixed ? Thanks.
try

<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<H1>JSP Test </H1>
Time: <% = new java.util.Date().toString()%>
</body>
</html>

util.Date is depreciated class though but I think you main purpose is not the class but the concept of how jsp prints a server out put...

Author

Commented:
sorry ....... err ..... does this mean I won't be able to display Date() ? or what does this mean exactly ? Thanks !

meow.
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
tremove the space between % and =:

<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<H1>JSP Test </H1>
Time: <%= new java.util.Date() %>
</body>
</html>

Author

Commented:
Hi ....

TO  Kuldeepchaturvedi:
   I tried ur code, but then I got an empty page ... blank ...

TO objects:
   I tried ur code, ... I still do not see the time :(

It seems that I must have some other mistakes in my system ... is that possible that because I didn't start the server properly ? or it doesn't matter ? thanks ..

Please help ... thanks !

Author

Commented:
To K:

  sorry ... it is not an "Empty page", but there is only "JSP Test", don't even see "Time:".......
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
try restarting your server and loading the code I posted with the following added to top of page:
<%@ page language="java" contentType="text/html" %>
What server are you using?

Author

Commented:
in J2EE .... I choose "start default server" .... is this a right thing to do or not ? Thanks !

Author

Commented:
Hi objects,

 I tried :
------------
<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<%@ page language="java" contentType="text/html" %>
<H1>JSP Test </H1>
Time: <%=new java.util.Date() %>
</body>
</html>
-------------
and

<%@ page language="java" contentType="text/html" %>
<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<%@ page language="java" contentType="text/html" %>
<H1>JSP Test </H1>
Time: <%=new java.util.Date() %>
</body>
</html>
----------------

both cases I got :
-----------------
JSP Test
Time:
--------------------

Did I do anything wrong ??? THanks ..... meow.
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
does the file have a .jsp extension?

Author

Commented:
Yes. It has .jsp extension
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
That all looks ok, arew u sure you requesting the jsp from your j2ee server, and not a web server.

Author

Commented:
err .... I am not sure actually! This might be the problem.....

After I have the "a cup of coffee" icon on my status bar ......
I just double clicked the file "Hello_new3.jsp" directly ..... then I saw the file .... but I am not sure whether it is started from the j2ee server or a webserver ... how do I check this ?
Thanks !!!

Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
> I just double clicked the file "Hello_new3.jsp" directly

thats your problem, you need to request the file from the j2ee server:

eg. http://localhost:8000/test.jsp

Author

Commented:
so ..... where should I place the "Hello_new3.jsp" ? which  path(directory) should I put the file ? Thanks !
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
you need to put in whatever directory your j2ee server stores its jsp files.

Author

Commented:
I see ........... please don't kill me ....... but but .... in my J2EE directory .. I only see directories like :bin, docs, lib, jdk, imq ..... How do I know which directory J2EE server store the jsp files ? This is my first time .... should I make a new folder (directory ) ? Thanks !
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
didn't u say in your other q that you could already load jsp's from your j2ee server?
If this is the case then you just need to find what directory those jsp's are in.

Author

Commented:
err ... I must have made silly mistakes .... I have never loaded a .jsp before .... (I tried ... not succeed yet ) ....sorry .... what should I do now ? many thanks !
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
sorry for bugging u guys so long .... thanks for the information ... I will check it out !
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.