java项目jsp怎么改,如何更改TOMCAT默认的JSP运行路径

Question:

怎么修改配置文件?

Answer:

Unless you are using a "J2EE web application" there is no simple way to do this. I would suggest creating a new web application and registering it with tomcat.

A web application is essentially a standardised directory structure containing all of the resources for your application. Using this standardised approach means that you can migrate your application to another JSP 1.1/Servlet 2.2 compatible server in the future very easily.

The examples directory under your tomcat webapps directory (c:\tc\jakarta-tomcat\webapps) is a good example of how to setup a webapp, and the important points to note are the WEB-INF directory and its web.xml file.

Once you've setup your web application, you can register it with tomcat by opening up the server.xml file from the "conf" directory under your tomcat installation. Again, take a look at how the example application is registered and use the same mechanism for registering your new webapp. All you need to do is specify the "docBase" attribute as a fully qualified path.

上面的文字大体的讲清楚了如何自己建一个目录来跑JSP和CLASS。我在 UNIX 下按自己的理解做了实验,OK,成功了,请你在 WIN 下也试试,把你的结果贴出来,好吗?

1。open /conf/server.xml and add the following code:

docBase="/www/jsp001"

crossContext="true"

debug="0"

reloadable="true"

trusted="false" >

修改上面的 path 和 docBase

2.Copy the directory /webapps/examples and the WAR file /webapps/examples.war to /www ,change it name to jsp001 and jsp001.war

3.Restart tomcat

4.See what's happened => http:///jsp001_test/

正常的话,你应该看到和 http:///examples/ 一样的内容。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值