我的tomcat的root跟下有很多文件夹
比如说 jtj文件夹czc文件夹ysgl文件夹
每个文件夹都是个独立的网站。里边都有自己的index.jsp
我想要输入不同的域名能看到不同文件夹下的index.jsp我按照http://hi.baidu.com/linhg/blog/item/8f30d2243ed57c034c088d34.html上配置了也改了C:\WINDOWS\system32\drivers\etc\hosts文件看下我改的server.xml
 <Connector
port="80"               maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" /> //port我改成80<Engine name="Catalina" defaultHost="www.jtj.com">///defaultHost改成www.jtj.com原来是localhost<Host name="www.jtj.com" appBase="webapps"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">//name也改了<Context path="/jtjwz" reloadable="true" docBase="C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/ROOT/jtjwz" />
</Host>
C:\WINDOWS\system32\drivers\etc\hosts文件127.0.0.1       localhost
192.168.0.15 www.jtj.com //新加的自己的IP执行http://www.jtj.com却看到的是root根下的index.jsp我还要改那里?
是conf下的web.xml吗?要怎么改才能指向root下不同文件夹下的index.jsp

解决方案 »

  1.   

    请参考我的虚拟主机配置文件
    http://www.java2000.net/viewthread.jsp?tid=203hosts 你那样修改也可以,不过这样更简单127.0.0.1   localhost 
    127.0.0.1   www.jtj.com   //新加的自己的IP 
      

  2.   

    应该是直接添加一个<Host>就行了,
      

  3.   

    大哥们还是不行啊。能否吧你们的
    server.xml给我看看我这是多个域名绑定同一个IP。这样配置行吗?
      

  4.   

    可以 在同一个<host里面添加多个<Context   path="/jtjwz"注意 你这么配置以后网址为http://www.jtj.com/jtjwz
      

  5.   

    我的配置<Connector
    port="80"      maxHttpHeaderSize="8192"
                   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
                   enableLookups="false" redirectPort="8443" acceptCount="100"
                   connectionTimeout="20000" disableUploadTimeout="true" /><Engine name="Catalina" defaultHost="localhost">
      <Host name="www.jtj.com" appBase="webapps"
           unpackWARs="true" autoDeploy="true"
           xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\jtjwz" debug="0"reloadable="true"/>
     </Host>
    </Engine>吧C:\WINDOWS\system32\drivers\etc\hosts文件
    127.0.0.1       localhost
    192.168.0.15 www.jtj.com打上http://www.jtj.com回车
    进的是root根下的index.jsp不是
    root/jtjwz/index.jsp我要改那????
      

  6.   

    先改这个
    127.0.0.1               localhost 
    127.0.0.1  www.jtj.com 
      

  7.   

    <Host name="localhost" appBase="webapps" 
           unpackWARs="true" autoDeploy="true" 
           xmlValidation="false" xmlNamespaceAware="false">
      <Context path="" docBase="ROOT" debug="0" reloadable="true"></Context> 
    </host>
    <Host name="www.jtj.com"   appBase="webapps" 
         unpackWARs="true"   autoDeploy="true" 
         xmlValidation="false"   xmlNamespaceAware="false"> 
      <Context   path=""   docBase="C:\Program   Files\Apache   Software   Foundation\Tomcat   5.5\webapps\ROOT\jtjwz" debug="0"  reloadable="true"/> 
    <Host> 第一个是原始的,就不要动了
    第二个是你新加的域名
    如果还有第三个,就把第二个复制一份,改一下目录和名字就可以了
      

  8.   

    我照你的做了地址栏打www.jtj.com还是访问root下的那个index.jsp也就是咱们安装tomcat后测试看到的黄页啊还是没有实现打www.jtj.com直接打开的是root/jtjwz/index.jsp啊我哭了。
      

  9.   

    把 jtjwz 挪到 c:\jtjwz 里面去
    然后修改
    [code=INIFile]<Host name="www.jtj.com"   appBase="webapps" 
         unpackWARs="true"   autoDeploy="true" 
         xmlValidation="false"   xmlNamespaceAware="false"> 
      <Context path="" docBase="d:/jtjwz" debug="0"  reloadable="true"/> 
    <Host> [/code]如果启动tomcat没有出现错误,应该成功了! 仔细看看日志/控制台输出
      

  10.   

    谢谢java2000_net兄弟。我现在能进到 root/jtjwz/index.jsp了可是在没有动的情况下出了很多错误。可是在不调试这写的时候网页是正常的啊。什么也没动啊org.apache.jasper.JasperException: Unable to compile class for JSPGenerated servlet error:
    Only a type can be imported. webjtj.qian.aqcs.SelectAqcs resolves to a packageGenerated servlet error:
    Only a type can be imported. webjtj.qian.QTContent.SelectContent resolves to a packageGenerated servlet error:
    Only a type can be imported. webjtj.hou.xgxz.UploadDoc resolves to a packageGenerated servlet error:
    Only a type can be imported. webjtj.qian.dtxw.selectDtxw resolves to a packageGenerated servlet error:
    Only a type can be imported. webjtj.qian.QTContent.BottomLinks resolves to a packageAn error occurred at line: 3 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 3 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 3 in the jsp file: /body.jsp
    Generated servlet error:
    UploadDoc cannot be resolved to a typeAn error occurred at line: 3 in the jsp file: /body.jsp
    Generated servlet error:
    UploadDoc cannot be resolved to a typeAn error occurred at line: 404 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 404 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 447 in the jsp file: /body.jsp
    Generated servlet error:
    UploadDoc cannot be resolved to a typeAn error occurred at line: 447 in the jsp file: /body.jsp
    Generated servlet error:
    UploadDoc cannot be resolved to a typeAn error occurred at line: 3 in the jsp file: /show.jsp
    Generated servlet error:
    selectDtxw cannot be resolved to a typeAn error occurred at line: 3 in the jsp file: /show.jsp
    Generated servlet error:
    selectDtxw cannot be resolved to a typeAn error occurred at line: 11 in the jsp file: /show.jsp
    Generated servlet error:
    selectDtxw cannot be resolved to a typeAn error occurred at line: 11 in the jsp file: /show.jsp
    Generated servlet error:
    selectDtxw cannot be resolved to a typeAn error occurred at line: 550 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 550 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 586 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 586 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 710 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 710 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 752 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 752 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 790 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 790 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 839 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 839 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 884 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 884 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 898 in the jsp file: /body.jsp
    Generated servlet error:
    selectContent cannot be resolvedAn error occurred at line: 898 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 898 in the jsp file: /body.jsp
    Generated servlet error:
    SelectContent cannot be resolved to a typeAn error occurred at line: 2 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a typeAn error occurred at line: 2 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a typeAn error occurred at line: 43 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a typeAn error occurred at line: 43 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a typeAn error occurred at line: 54 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a typeAn error occurred at line: 54 in the jsp file: /bottom.jsp
    Generated servlet error:
    BottomLinks cannot be resolved to a type
    org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
    调成这样的还有什么其他的规定吗?
      

  11.   

    你程序的问题,仔细看看
    import 语句吧,一般是
    import="mypackage.*"
    这样来使用的。
      

  12.   

    <%@ page import="webjtj.qian.aqcs.SelectAqcs,webjtj.qian.QTContent.SelectContent,java.util.*,webjtj.hou.xgxz.UploadDoc"%>
    我都是这么写的啊。在没配置域名前。都好用啊。配置完了就不好用了怎么回事郁闷整了3天了。
      

  13.   

    而且我在jsp文件里 凡是写<jsp:useBean >标签的地方都报错org.apache.jasper.JasperException: /dtxw/listnews.jsp(4,0) The value for the useBean class attribute webjtj.hou.news.NewsList is invalid.好像都是找不到类。我吧类的放到WEB-INF/classes里了。还用放到其他地方吗?