Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 7th, 2003, 08:27 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Having Problem with Tomcat and/or JDK

I downloaded and installed the Tomcat server. Then changed by system settings on my windows 98 machine and restarted my machine. But when I run a simple JSP (with in it <% new java.util.Date() %>, everything that is straight html appears. I know there has to be a simple answer to this.

Reply With Quote
  #2 (permalink)  
Old July 9th, 2003, 12:11 PM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jwenting Send a message via MSN to jwenting
Default

You need to be a bit clearer here, what exactly is going wrong (or what do you expect to happen and what do you observe to happen)?
Reply With Quote
  #3 (permalink)  
Old July 9th, 2003, 02:53 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The following code :
<html>
  <head>
    <title>My First JSP</title>
  </head>

  <body>
    Hello world!<br>
    The current date and time is <%= new java.util.Date() %>
  </body>
</html>

produced the following:

Hello World!
The current date and time is

I put the JSP file in the folder begjsp-ch01 which is a sub directory of webapps.

Hopefully this is a bit clearer.

Quote:
quote:Originally posted by jwenting
 You need to be a bit clearer here, what exactly is going wrong (or what do you expect to happen and what do you observe to happen)?
Reply With Quote
  #4 (permalink)  
Old July 10th, 2003, 08:58 AM
Authorized User
 
Join Date: Jun 2003
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to jwenting Send a message via MSN to jwenting
Default

It looks like it's serving the file as plain HTML.

You probably saved the file as HTML instead of JSP (extension should be .jsp else Tomcat won't pass it to the JSP compiler/servlet engine but serve it as HTML in which case the <%= new java.util.Date() %> tag is simply passed on without parsing to your browser (which will then ignore it because it doesn't know what to make of it).

Also, while not strictly required it's good form to start a JSP with a tag <%@ page language="java" %>
Reply With Quote
  #5 (permalink)  
Old July 10th, 2003, 09:51 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out the reason I was getting that the JSP code was not executing was opening the JSP using windows explorer and launching it with IE instead of keying in the URL http://localhost/begjsp-ch01/index.jsp. The reason I did it was when I keyed in the URL Tomcat gave me an error message saying the file was not available.

I got to to work by creating a subdirectory begjsp-ch01 from the examples directory and keying the appropriate URL. Does any new sub directory off of webapps need to be registered somewhere?

Reply With Quote
  #6 (permalink)  
Old July 29th, 2004, 10:24 AM
Registered User
 
Join Date: Jul 2004
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by evenpar
 I found out the reason I was getting that the JSP code was not executing was opening the JSP using windows explorer and launching it with IE instead of keying in the URL http://localhost/begjsp-ch01/index.jsp. The reason I did it was when I keyed in the URL Tomcat gave me an error message saying the file was not available.

I got to to work by creating a subdirectory begjsp-ch01 from the examples directory and keying the appropriate URL. Does any new sub directory off of webapps need to be registered somewhere?

I am having the same problem....
Are you saying that you literally copied the jsp-examples folder to the begjsp-ch01 folder, added the first JSP file in book - index.jsp - and it worked? Please tell me!!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with tomcat any help? araknee Apache Tomcat 1 June 12th, 2008 07:04 AM
Facing problem with tomcat 5.5.9 bhojrajjoshi Apache Tomcat 14 September 26th, 2006 04:44 AM
configure tomcat to run both JDK 1.4.2 and 1.5.0 draggy Apache Tomcat 3 April 17th, 2006 04:04 AM
Apache, Axis and JDK for web service problem solomon_13000 Apache Tomcat 0 August 26th, 2005 08:16 AM
JDK 1.5 Setup Problem treehh JSP Basics 1 June 22nd, 2005 11:24 PM



All times are GMT -4. The time now is 10:01 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.