编辑tomcat/conf/server.xml文件
在<Context path="/examples" docBase="examples" debug="0" 
               reloadable="true"> 
   ..........
  </Context>
的前面或者后面加上
<Context path="/myapp" docBase="你的目录的路径" debug="0"  (在这里) 
               reloadable="true"/> 
然后你的目录安排如下
根目录
------+/WEB-INF/(required)
|     |
|     |----+/classes/(option)
|     |    |----------*.class
|     |
|     |----+/lib/(option)
|     |    |----------*.jar
|     |
|     +---web.xml(required)
|     +---weblogic.xml(option)
|
|
|-----*.html
|-----*.jsp
|-----其他资源,如图片等

解决方案 »

  1.   

    开头的我已经加上了,至于目录树和web.xml,有没有自动创建的工具,因为这些东西应该是很固定的。
      

  2.   

    自动的工具是没有的,不过 你要使用 jbuilder的话,那里都会有的
    在你的项目下面 有一个 defaultroot目录 ,编译完,就是了
      

  3.   

    修改你的目录下的\WEB-INF\下的web.xml
    在<web-app></web-app>中加入下面的,就可以访问servlet了
     <servlet><servlet-name>HelloServlet</servlet-name><servlet-class>HelloServlet</servlet-class></servlet>
     <servlet-mapping><servlet-name>HelloServlet</servlet-name><url-pattern>/hello</url-pattern></servlet-mapping>
    servlet-class是你的servlet的类的名字
    2个servlet-name是一样的
    url-pattern是你访问的路径
    比如你的目录web访问是http://127.0.0.1/root  
    servlet 就是http://127.0.0.1/root  + url-pattern
    你的目录安排如下
    根目录
    ------+/WEB-INF/(required)
    |     |
    |     |----+/classes/(option)
    |     |    |----------*.class
    |     |
    |     |----+/lib/(option)
    |     |    |----------*.jar
    |     |
    |     +---web.xml(required)
    |
    |-----*.html
    |-----*.jsp
    |-----其他资源,如图片等