• Post Reply Bookmark Topic Watch Topic
  • New Topic

Trouble with first simple JSP  RSS feed

 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried using the following HTML in a file called "First.jsp"
<html>
<body>
the date is <%=new java.util.Date()%>
</body>
</html>
I don't get anything from the code inside of the "<%= %>" tag. Is there something I'm doing wrong. I'm not sure of what servlet engine is used on the server but there is a servlet directory which is a direcory above the directory with my "First.jsp" file. Does it matter which directory I put it in? As I said this is my first shot at JSP so any help would be appreciated.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. There are specific distinct dirs for sevlets and jsps. Which servlet engine are you using. Please tell us which dir , (whole physical path) you copied your first.jsp and how did you invoke from browser.
Everyone strugles to get the first jsp working properly. It is just that which file goes where. Then onwards you will enjoy!
regds
maha anna
 
Ronnie Phelps
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using the iplanet web server4.1. My first.jsp file is in the directory /opt/software/www/rphelps
There's a servlet directory located at /opt/software/www/servlet
First I tried invoking the first.jsp by just going to the page by entering the URL in my browser. Next I tried going to another page and clicking on a link that sent me to the first.jsp page and both times I received a message saying that "There is a problem with the page you are trying to reach and it can't be displayed". I think I might have to configure the server to use JDK instead of JRE so I'm gonna look into that and I'll let you know if I had any luck.
 
Winston Smith
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks like the reason you're getting nothing inside the <%= %> tags is because you're simply instantiating a new Date object. If you want to display the current date, do something like the following:
<%
Date d = Calendar.getInstance().getTime();
out.println(d.toString();
%>
and you can later call on the same Date object as so:
The current date is <%= d.toString() %>
 
Elinor Chang
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSP itself is perfect. There is NOTHING wrong with it. Please check if your servlet engine is not started/configured alright...
 
john guthrie
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elinor Chang is right. nothing wrong with that jsp at all...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do a 'view source' from the browser to see if your expression scriptlet has been translated. if not, your page is not being passed through the JSP engine.
hth,
bear
[ July 30, 2003: Message edited by: Bear Bibeault ]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!