我整个一个web应用包放到tomcat下的webapp目录下了
比如叫lxz,怎样才能做到在IE里输入http://本机IP:8080
就能浏览到http://本机IP:8080/lxz/login.jsplogin.jsp就是lxz目录下的一个文件.

解决方案 »

  1.   

    此回复为自动发出,仅用于显示而已,并无任何其他特殊作用
    楼主【liuxinzhi1982】截止到2008-06-26 08:51:31的历史汇总数据(不包括此帖):
    发帖数:16                 发帖分:550                
    结贴数:15                 结贴分:530                
    未结数:1                  未结分:20                 
    结贴率:93.75 %            结分率:96.36 %            
    值得尊敬
      

  2.   

    在web.xml中配置一下哦
    <welcome-file-list>
    <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
      

  3.   

    工程的web.xml里配置
    <welcome-file-list>
         <welcome-file>login.jsp</welcome-file>
    </welcome-file-list>
      

  4.   

    楼主要的是,输入http://本机IP:8080 么,
    楼上两位大哥,都指的是输入http://本机IP:8080/lxz  看到文件login.jsp楼主您是想
    http://本机IP:8080  看到lxz/login.jsp 
    //
      

  5.   

      没具体的工程 他怎么知道找的就是 这个工程名下的 lxz下的JSP呢。
      

  6.   

    是想 
    http://本机IP:8080  看到lxz/login.jsp 
      

  7.   

    把项目打包呀,放到webapp下面,启动TOMCAT。
      

  8.   

    如果用myEclipse的话可以在工程名上点右键->properties->myeclipse->web ,将web context-root设为/(默认为/工程名,把工程名去掉)就可以了
      

  9.   

    在tomcat的server.xml
    中的<Host></Host>中加入 <Context   path=""   docBase="lxz的绝对路径"   debug="0"/>然后在你的工程的web.xml下加入<welcome-file-list> 
    <welcome-file>login.jsp </welcome-file> 
    </welcome-file-list>
      

  10.   

    在 struts2 或 webwork 中可以配置实现,比如:   1.  <?xml version="1.0" encoding="UTF-8" ?>  
       2. <!DOCTYPE struts PUBLIC   
       3.         "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"   
       4.         "http://struts.apache.org/dtds/struts-2.0.dtd">  
       5. <struts>  
       6.     <include file="struts-default.xml"/>  
       7.     <package name="helloworld" namespace="/" extends="struts-default">  
       8.         <interceptors>  
       9.             <interceptor name ="authentication" class ="com.jamesby.struts2.LogonInterceptor"/>    
      10.             <interceptor-stack name="helloWorldStack">  
      11.                 <interceptor-ref name="authentication"/>  
      12.                 <interceptor-ref name="paramsPrepareParamsStack"/>  
      13.             </interceptor-stack>  
      14.         </interceptors>     
      15.         <default-interceptor-ref name="helloWorldStack"/>  
      16.         <global-results>  
      17.             <result name="login">/WEB-INF/jsp/Logon.jsp</result>                   
      18.                   </global-results>        
      19.         <action name="Logon_*" method="{1}" class="com.jamesby.struts2.Logon">  
      20.             <interceptor-ref name="paramsPrepareParamsStack"/>         
      21.             <result type="redirect-action">Main</result>  
      22.             <result name="input">/WEB-INF/jsp/Logon.jsp</result>           
      23.         </action>  
      24.         <action name="crud" method="{1}" class="com.jamesby.struts2.UserAction">  
      25.             <result name="list">/WEB-INF/jsp/userList.jsp</result>              <result name="success" type="redirect-action">crud!list</result>  
      26.             <result name="input">/WEB-INF/jsp/userForm.jsp</result>  
      27.         </action>  
      28.         <action name="*" class="com.jamesby.struts2.ExampleSupport">  
      29.             <result>/WEB-INF/jsp/{1}.jsp</result>  
      30.         </action>            
      31.     </package>  
      32. </struts>  
      

  11.   

    11楼正解不过我总觉得打包后发布不太方便,总是会有虚拟路径名,如果有办法不用去配置,又能够把虚拟路径名去掉,那样就比较方便了一般来说,11楼的解决方法可以再改进下
    重新做个Host,把域名等信息放进去(域名可以自己随便选一个,在本机host里做一下就可以),这样以后访问的时候就可以跟在网上访问效果一样,有时候这么做会方便开发示例:
    server.xml:
    <Host name="tool.caibn.net"  appBase="webapps"
                unpackWARs="true" autoDeploy="true"
                xmlValidation="false" xmlNamespaceAware="false">
    <Context crossContext="true" displayName="uucall sys"
     path="" docBase="D:\JAVA_APP\caiban\CBToolBox\WebRoot" reloadable="true" >
    </Context>
    </Host>host:
    127.0.0.1    tool.caiban.net