我整个一个web应用包放到tomcat下的webapp目录下了
比如叫lxz,怎样才能做到在IE里输入http://本机IP:8080
就能浏览到http://本机IP:8080/lxz/login.jsplogin.jsp就是lxz目录下的一个文件.
比如叫lxz,怎样才能做到在IE里输入http://本机IP:8080
就能浏览到http://本机IP:8080/lxz/login.jsplogin.jsp就是lxz目录下的一个文件.
楼主【liuxinzhi1982】截止到2008-06-26 08:51:31的历史汇总数据(不包括此帖):
发帖数:16 发帖分:550
结贴数:15 结贴分:530
未结数:1 未结分:20
结贴率:93.75 % 结分率:96.36 %
值得尊敬
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
楼上两位大哥,都指的是输入http://本机IP:8080/lxz 看到文件login.jsp楼主您是想
http://本机IP:8080 看到lxz/login.jsp
//
http://本机IP:8080 看到lxz/login.jsp
中的<Host></Host>中加入 <Context path="" docBase="lxz的绝对路径" debug="0"/>然后在你的工程的web.xml下加入<welcome-file-list>
<welcome-file>login.jsp </welcome-file>
</welcome-file-list>
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>
重新做个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