• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

deployment directory  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using Tomcat 5.028. How to configure tomcat to run jsp files without copy the files to /<tomcat-installation-dir>/webapps/...

For example, c:\myJsp\test.jsp

Thanks.
 
Ranch Hand
Posts: 510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand your question. Are you trying to run a JSP without going thru the Servlet container as if this werer a little problem with a main method?
 
chailin fong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I meant was , if I put all my jsp files in one directory, named "c:\myJSP"

Without placing the file into /tomcat/webapps/.. directory, the URL link will "point" to "c:\myJSP\test.jsp
ie, http://localhost:8080/myjsp/test.jsp

Editing server.xml?
 
Sheriff
Posts: 67259
170
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Refer to the Tomcat documentation for setting up contexts.
[ October 16, 2007: Message edited by: Bear Bibeault ]
 
chailin fong
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I add the line below in server.xml
<Context path='/jspbook' docBase='c:\jspbook' debug='0' reloadable='true'>
</Context>

I try to access the application: http://localhost:8080/jspbook/hello.jsp

I got : HTTP Status 404 - the requested resource (/jspbook/hello.jsp) is not available.
 
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by chailin fong:
I add the line below in server.xml
<Context path='/jspbook' docBase='c:\jspbook' debug='0' reloadable='true'>
</Context>

I try to access the application: http://localhost:8080/jspbook/hello.jsp

I got : HTTP Status 404 - the requested resource (/jspbook/hello.jsp) is not available.




It would be better to follow Bear Bibeault's directions and check the documentation. Adding context entries to the server.xml file is not considered a best practice in Tomcat 5.0 and up.
Also, Tomcat will not treat your directory as a web application unless there is a proper directory structure within it.
 
I can't take it! You are too smart for me! Here is the tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!