SSH2访问首页问题!急急急!
在网上下载了一个网络商城的项目文件包,文件路径如图:
webroot文件夹中的index.jsp之显示页面正在加载,web-inf/pages下的inex.jsp 显示的是首页!
在导入到myeclipse8.5中并将数据库文件导入到数据库中后,我无法进入首页,加载页面可以正常显示?
这是为什么?
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>Shop</display-name>
	<!-- 对Spring容器进行实例化 -->
	<listener>
		<listener-class>
org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>classpath:applicationContext-*.xml</param-value>
	</context-param>
	<!-- OpenSessionInViewFilter过滤器 -->
	<filter>
		<filter-name>openSessionInViewFilter</filter-name>
		<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>openSessionInViewFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>
	<!-- Struts2配置 -->
	 <filter>
         <filter-name>struts2</filter-name>
         <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
     </filter>
     <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
    </filter-mapping>
	<!-- 设置程序的默认欢迎页面-->
	<welcome-file-list>
		<welcome-file>/Shop/WEB-INF/pages/index.jsp
</welcome-file>
	</welcome-file-list>
</web-app>
------解决方案--------------------WEB-INF下的文件是不能直接访问的,要通过action转发,就是return "success"来转发到WEB-INF的jsp。
放在WEB-INF下的好处就是方便进行权限判断,需要登录后才能访问的页面都是放在里面。。
------解决方案--------------------你可以自己在webroot下面写个index.jsp 然后在里面转发到WEB-INF里面这个jsp
------解决方案--------------------
WEB-INF下的资源是不能直接访问的,你需要把index.jsp移到webapps根目录下,
并且改成如下
<!-- 设置程序的默认欢迎页面-->
<welcome-file-list>
<welcome-file>index.jsp
</welcome-file>
</welcome-file-list>
</web-app>