Win a copy of Functional Reactive Programming this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic

How to run my own jsp file?

 
Prosenjit Banerjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Prosenjit Banerjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 102
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please somebody help me, please.
 
Abhijeet Vaidya
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
Prosenjit Banerjee
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thank you very very much. Now it's working. Thanks a lot
 
    Bookmark Topic Watch Topic
  • New Topic