Solved

new-b questions ....

Posted on 2004-04-07
24
209 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.
0
Comment
Question by:meow00
  • 12
  • 9
  • 3
24 Comments
 
LVL 19

Expert Comment

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

0
 
LVL 1

Author Comment

by:meow00
ID: 10777279
er .......... I still got the same result .......

..... is there anything else might need to be fixed ? Thanks.
0
 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 10777524
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...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

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

meow.
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 20 total points
ID: 10777667
<html>
<head><title> JSP Test </title></head>
<body bgcolor = "#FDF5E6">
<H1>JSP Test </H1>
<%
java.text.DateFormat df = java.text.DateFormat.getDateInstance();

Time: <% = df.format(new java.util.Date())%>
</body>
</html>
0
 
LVL 92

Expert Comment

by:objects
ID: 10779165
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>
0
 
LVL 1

Author Comment

by:meow00
ID: 10779290
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 !
0
 
LVL 1

Author Comment

by:meow00
ID: 10779303
To K:

  sorry ... it is not an "Empty page", but there is only "JSP Test", don't even see "Time:".......
0
 
LVL 92

Expert Comment

by:objects
ID: 10779383
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?
0
 
LVL 1

Author Comment

by:meow00
ID: 10779413
in J2EE .... I choose "start default server" .... is this a right thing to do or not ? Thanks !
0
 
LVL 1

Author Comment

by:meow00
ID: 10779801
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.
0
 
LVL 92

Expert Comment

by:objects
ID: 10779819
does the file have a .jsp extension?
0
 
LVL 1

Author Comment

by:meow00
ID: 10779840
Yes. It has .jsp extension
0
 
LVL 92

Expert Comment

by:objects
ID: 10779879
That all looks ok, arew u sure you requesting the jsp from your j2ee server, and not a web server.
0
 
LVL 1

Author Comment

by:meow00
ID: 10779900
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 !!!

0
 
LVL 92

Expert Comment

by:objects
ID: 10779911
> 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
0
 
LVL 1

Author Comment

by:meow00
ID: 10780245
so ..... where should I place the "Hello_new3.jsp" ? which  path(directory) should I put the file ? Thanks !
0
 
LVL 92

Expert Comment

by:objects
ID: 10780266
you need to put in whatever directory your j2ee server stores its jsp files.
0
 
LVL 1

Author Comment

by:meow00
ID: 10780280
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 !
0
 
LVL 92

Expert Comment

by:objects
ID: 10780331
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.
0
 
LVL 1

Author Comment

by:meow00
ID: 10780351
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 !
0
 
LVL 92

Accepted Solution

by:
objects earned 180 total points
ID: 10780446
heres a good start for you :)
http://java.sun.com/j2ee/1.4/docs/index.html
0
 
LVL 1

Author Comment

by:meow00
ID: 10780461
sorry for bugging u guys so long .... thanks for the information ... I will check it out !
0
 
LVL 92

Expert Comment

by:objects
ID: 10780465
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
xjc and jaxb 2 95
JSP Popup page 2 159
Multiple Images Upload [JSP Web-application] 3 48
approach on java challenges Approach on java challenges or real world challenges 29 161
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question