• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difficulty in first jsp programm

 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all !!!

From 2-3 days i am trying to to run the first jsp program from hfsj but every time get error as reqested resource not available.....i also tried some other jsp program but get same error...........i go through the google for finding solution,,,,,,,bt not succed
the program is count.jsp


count.jsp is in C:\tomcat\webapps\star\count.jsp

and through IE i access it as........ http://localhost:8080/star/count.jsp

i dont understand what is the problem

Please Help !!!
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Tomcat started?

Also, please put code into the code tags.
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes tomcat get started........if i use some html file then it run properly but for jsp file gives error
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code looks fine I cant see any problem and the directory structure is okay too.

What exactly is your error code? 404 or 500?
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it gives error as

HTTP Status 404 - /star/count.jsp

--------------------------------------------------------------------------------

type Status report

message /star/count.jsp

description The requested resource (/star/count.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/5.5.27
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for ruuning jsp is it necessary to set Path and classpath environment variable ???
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my jdk is in C:\Progrm Files\Java\jdk1.5.0_19
tomcat in C:\tomcat

I set Path as...C:\Progrm Files\Java\jdk1.5.0_19\bin

and classpath as...C:\Progrm Files\Java\jdk1.5.0_19\bin;C:\tomcat\common\lib\servlet-api.jar

is this correct or not??
 
Sebastian Janisch
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have a valid web.xml file set up? Otherwise the server won't deploy your web-app, hence JSP files will not get translated.
 
Himanshu Kansal
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Geet,
I guess if you go to the command line and start tomcat from under the {CATALINA-HOME}/bin dir using startup.bat, you will get JAVA_HOME not found, using JRE_HOME blah blah.

set an env variable named JAVA_HOME="C:\Progrm Files\Java\jdk1.5.0_19"

Regards

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you see when you access http://localhost:8080/ ?
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I make web.xml file but still not working........I try in both way as with and without web.xml file,,,but not getting output.....

and you are right Himanshu...when tomcat get started i find JRE_HOME ....C:\Program Files\Java\jdk1.5.0_19 and no JAVA_HOME...

with http://localhost/8080/ i found the tomcat home page.......
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\tomcat\webapps\star\
1. Is this the directory used for your Tomcat installation ? If you put a hello.html into this directory, can you access it ?
2. Type "dir" in this directory and post the results here.
 
geet rahane
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I put a simple html file in the star directory then it run properly and gives the output.....
I creates one simple my.html file to print hello.,.......it get displayed.........

from command line

C:\tomcat\webapps\star>dir I get result as

Volume in drive C has no label
Volume Serial Number is d8F7-4FA7

Directory of C:\tomcat\webapps\star

7/24/2009 10:12 PM <DIR> .
7/24/2009 10:12 PM <DIR> . .
7/28/2009 06:48 PM 63 my.html
7/24/2009 09:48 PM 99 count.jsp.txt
2 File<s > 162 bytes
2 Dir<s> 3,762,913,280 bytes free

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
count.jsp.txt ? Did you write your jsp file with notepad ? You have used an editor which appended the ".txt" extension to your filename. Rename it to "count.jsp".
 
krishna bala
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

please check yourdirectory structure

PROJECT Name
src
WEB-INF
classes
lib
web.xml

for web application , development , we have to follow the above package structure
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic