wood burning stoves*
The moose likes JSP and the fly likes How to run my own jsp file? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "How to run my own jsp file?" Watch "How to run my own jsp file?" New topic
Author

How to run my own jsp file?

Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Hi,
I know this is a very stupid question. But I am a beginner in JSP and is bit confused using it since not only JSP but web programming is very new to me.
Please somebody tell me how do I run a JSP file after writing it using an editor like Notepad.
I have installed Tomcat and can run the example file of Tomcat using an address as follows:
http://localhost:8080/jsp-examples/colors/colrs.jsp

I wanted to run some JSP files after keeping then in a folder called pband. I kept a file named index.jsp in a folder named pband and them kept the folder under <tomcat installation path>\jsp-examples\
and then executed the file from a browser by writing the following address:
http://localhost:8080/jsp-examples/pband/
and it worked fine.

But here is the problem: Now I copied the folder pband under the path <tomcat installation path> and tried to executed the file by writing the following address:
http://localhost:8080/pband/
and it DID NOT WORK. Why?

Please somebody explain to me clearly. Thank you very much.
[ August 20, 2007: Message edited by: Prosenjit Banerjee ]

Always say the TRUTH only
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

http://localhost:8080/pband/ and it DID NOT WORK. Why?

In Tomcat, web applications are kept under the "webapps" folder. So under "webapps", copy your "pband" directory.
Moreover, web applications use a special directory called WEB-INF. (look in webapps/ROOT) So make one in your "pband" directory.
It will be a good idea to make a special file called "web.xml" into the WEB-INF directory. Copy the one which is in webapps/ROOT/WEB-INF, edit it, and remove the part between "JSPC servlet mappings start" and "JSPC servlet mappings end".(if you're using Tomcat 6, there will be nothing to remove)

Don't forget to restart Tomcat after that.


[My Blog]
All roads lead to JavaRanch
Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Thank you Christophe for your prompt answer. I did what you said and it worked! Thanks.
But now there is another problem.
I am studying a book named Beginning JaverServer Pages and supplied me some example codes.
C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ch02\ contains two files:
index.jsp (for selecting a portal using a drop down list)
showportal.jsp (dynamically renders the portal page)

index.jsp contains:


running it using address http://localhost:8080/ch02/example1/ works fine. Also clicking on the "select" button renders showportal.jsp having folling code:



The problem is: I copied both the index.jsp and showportal.jsp to my pband folder having the path C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\pband
Now the address http://localhost:8080/pband/ showd the index file correctly but on clicking the "Select" button an error page occured showing org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

Please tell me where am I going wrong.
[ August 20, 2007: Message edited by: Prosenjit Banerjee ]
Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Please somebody help me, please.
Abhijeet Vaidya
Greenhorn

Joined: Apr 16, 2007
Posts: 20
your showportal.jsp file uses JSTL (Java Standard Tag Library) tags. So you will require jstl.jar and standard.jar in your WEB-INF/lib.

required jars could be found here


Thanks and Regards,
Abhijeet
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Originally posted by Prosenjit Banerjee:
org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application


have a look at this. http://faq.javaranch.com/view?SetupJstlForJsp2


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Prosenjit Banerjee
Ranch Hand

Joined: Dec 18, 2002
Posts: 102
Thank you very very much. Now it's working. Thanks a lot
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to run my own jsp file?