20 分钟前 匿名 | 分类:JAVA相关 | 浏览3次
求助: 布署项目到远程linux上的tomcat上.布署成功后,访问不到jsp,静态资源文件也访问不到. 报404错误.
项目MVC层用的是struts2,在web.xml中配置的Struts2的.
如果我将web.xml文件中的struts2的配置删除掉.这时就可以访问到静态的资源文件,也可以直接访问JSP文件了.但是这样STRUTS2就没法用了呀.达不到效果.
求解.在WINDOWS下面,本地运行没有任何问题.WINDOWS下是jdk6+tomcat6
linux下也是jdk6+tomcat6.
不知道是不是LINUX下的tomcat的web.xml的DTD版本的问题,我看了一下.在tomcat的conf下面的web.xml文件里面的DTD是2.3版本的.而2.4以上就是用schema了.
10 个解决方案
#1
错误信息?较大的可能性是struts里的配置写错了,比如出现\之类的字符,最好贴出来看看
#2
struts2.xml
<struts>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<interceptors>
<!--1 注册自定义的拦截器. -->
<interceptor name="loginCheck" class="cn.cid.cd.action.interceptor.LoginInterceptor"/>
<!--2 注册一个拦截器栈,向里面添加单个的拦截器. -->
<interceptor-stack name="systemStack">
<interceptor-ref name="paramsPrepareParamsStack"/>
</interceptor-stack>
</interceptors>
<!--3:将我们定义的拦截器栈,设置为默认的拦截器 -->
<default-interceptor-ref name="systemStack"/>
<!-- 定义全局的视图 -->
<global-results>
<result name="login" type="redirect">
/login.jsp
</result>
<result name="Forbidden">
/forbidden.jsp
</result>
<result name="error">
/error.jsp
</result>
</global-results>
<!-- <global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"/>
</global-exception-mappings> -->
<action name="user_*" class="cn.itcast.cd.action.UserAction" method="{1}">
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
<action name="login" class="cn.itcast.cd.action.LoginAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result name="login">
/login.jsp
</result>
<result type="redirectAction">
<param name="actionName">main</param>
</result>
</action>
<action name="logout" class="cn.itcast.cd.action.LogoutAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result type="redirect">
/login.jsp
</result>
</action>
<action name="game_*" class="cn.cid.cd.action.GameInfoAction" method="{1}">
<result name="input">
/houtai_game_add.jsp
</result>
<result name="list">
/houtai_game_list.jsp
</result>
<result name="save" type="redirectAction">
game_list
</result>
<result name="delete" type="redirectAction">
game_list
</result>
<result name="get">
/gameInfo.jsp
</result>
<result name="logo" type="redirectAction">
game_list
</result>
</action>
<action name="dev_*" class="cn.cid.cd.action.DevloperAction" method="{1}">
<result name="input">
/houtai_dev_add.jsp
</result>
<result name="list">
/houtai_dev_list.jsp
</result>
<result name="save" type="redirectAction">
dev_list
</result>
<result name="delete" type="redirectAction">
dev_list
</result>
</action>
<action name="style_*" class="cn.cid.cd.action.GameStyleAction" method="{1}">
<result name="input">
/houtai_style_add.jsp
</result>
<result name="list">
/houtai_style_list.jsp
</result>
<result name="save" type="redirectAction">
style_list
</result>
<result name="delete" type="redirectAction">
style_list
</result>
</action>
<action name="sdk_*" class="cn.cid.cd.action.SDKVersionAction" method="{1}">
<result name="input">
/houtai_sdk_add.jsp
</result>
<result name="list">
/houtai_sdk_list.jsp
</result>
<result name="save" type="redirectAction">
sdk_list
</result>
<result name="delete" type="redirectAction">
sdk_list
</result>
</action>
<action name="image_*" class="cn.cid.cd.action.GameImageAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/houtai_img_list.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="query">
/show_img.jsp
</result>
</action>
<action name="forum_*" class="cn.cid.cd.action.ForumAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/enjoy.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="hotest">
/show_img.jsp
</result>
<result name="childlist">
/page3.jsp
</result>
</action>
</package>
web.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
<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>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>cn.cid.cd.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application.xml</param-value>
</context-param>
</web-app>
linux下tomcat的server.xml配置
<Context path="/wxcs" docBase="webapps/wxcs" debug="0" reloadable="true" privileged="true">
-----------------------------------------------------
下面是我的访问路径:
http://主机名:8080/wxcs/game_list
我是有LIST这个方法的哈.并且对应的JSP视图都直接在wxcs这个项目的根目录下面.项目也已经放在tomcat的webapps下面.叫wxcs
<struts>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<interceptors>
<!--1 注册自定义的拦截器. -->
<interceptor name="loginCheck" class="cn.cid.cd.action.interceptor.LoginInterceptor"/>
<!--2 注册一个拦截器栈,向里面添加单个的拦截器. -->
<interceptor-stack name="systemStack">
<interceptor-ref name="paramsPrepareParamsStack"/>
</interceptor-stack>
</interceptors>
<!--3:将我们定义的拦截器栈,设置为默认的拦截器 -->
<default-interceptor-ref name="systemStack"/>
<!-- 定义全局的视图 -->
<global-results>
<result name="login" type="redirect">
/login.jsp
</result>
<result name="Forbidden">
/forbidden.jsp
</result>
<result name="error">
/error.jsp
</result>
</global-results>
<!-- <global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"/>
</global-exception-mappings> -->
<action name="user_*" class="cn.itcast.cd.action.UserAction" method="{1}">
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
<action name="login" class="cn.itcast.cd.action.LoginAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result name="login">
/login.jsp
</result>
<result type="redirectAction">
<param name="actionName">main</param>
</result>
</action>
<action name="logout" class="cn.itcast.cd.action.LogoutAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result type="redirect">
/login.jsp
</result>
</action>
<action name="game_*" class="cn.cid.cd.action.GameInfoAction" method="{1}">
<result name="input">
/houtai_game_add.jsp
</result>
<result name="list">
/houtai_game_list.jsp
</result>
<result name="save" type="redirectAction">
game_list
</result>
<result name="delete" type="redirectAction">
game_list
</result>
<result name="get">
/gameInfo.jsp
</result>
<result name="logo" type="redirectAction">
game_list
</result>
</action>
<action name="dev_*" class="cn.cid.cd.action.DevloperAction" method="{1}">
<result name="input">
/houtai_dev_add.jsp
</result>
<result name="list">
/houtai_dev_list.jsp
</result>
<result name="save" type="redirectAction">
dev_list
</result>
<result name="delete" type="redirectAction">
dev_list
</result>
</action>
<action name="style_*" class="cn.cid.cd.action.GameStyleAction" method="{1}">
<result name="input">
/houtai_style_add.jsp
</result>
<result name="list">
/houtai_style_list.jsp
</result>
<result name="save" type="redirectAction">
style_list
</result>
<result name="delete" type="redirectAction">
style_list
</result>
</action>
<action name="sdk_*" class="cn.cid.cd.action.SDKVersionAction" method="{1}">
<result name="input">
/houtai_sdk_add.jsp
</result>
<result name="list">
/houtai_sdk_list.jsp
</result>
<result name="save" type="redirectAction">
sdk_list
</result>
<result name="delete" type="redirectAction">
sdk_list
</result>
</action>
<action name="image_*" class="cn.cid.cd.action.GameImageAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/houtai_img_list.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="query">
/show_img.jsp
</result>
</action>
<action name="forum_*" class="cn.cid.cd.action.ForumAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/enjoy.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="hotest">
/show_img.jsp
</result>
<result name="childlist">
/page3.jsp
</result>
</action>
</package>
web.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
<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>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>cn.cid.cd.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application.xml</param-value>
</context-param>
</web-app>
linux下tomcat的server.xml配置
<Context path="/wxcs" docBase="webapps/wxcs" debug="0" reloadable="true" privileged="true">
-----------------------------------------------------
下面是我的访问路径:
http://主机名:8080/wxcs/game_list
我是有LIST这个方法的哈.并且对应的JSP视图都直接在wxcs这个项目的根目录下面.项目也已经放在tomcat的webapps下面.叫wxcs
#3
<constant name="
struts.objectFactory" value="
spring"></constant>
交给spring管理了。
<action name="user_*" class=" cn.itcast.cd.action.UserAction" method="{1}">
class的值和spring里的bean的name值保持一致
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
交给spring管理了。
<action name="user_*" class=" cn.itcast.cd.action.UserAction" method="{1}">
class的值和spring里的bean的name值保持一致
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
#4
此问题怎么解决的啊,我也遇到同样的问题了
#5
防火墙关闭了吗
#6
我就是怕防火墙有问题,干脆没装防火墙
#7
此问题尚未解决,求大神帮助
#8
1.首先确定项目加载到了配置文件了没。2.加载报错了没。
#9
报404错误,在web.xml中去掉strust的配置文件后,就正常了,想用strust不知道怎么办
#10
求助啊,jsp未能加载成功,怎么办?
#1
错误信息?较大的可能性是struts里的配置写错了,比如出现\之类的字符,最好贴出来看看
#2
struts2.xml
<struts>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<interceptors>
<!--1 注册自定义的拦截器. -->
<interceptor name="loginCheck" class="cn.cid.cd.action.interceptor.LoginInterceptor"/>
<!--2 注册一个拦截器栈,向里面添加单个的拦截器. -->
<interceptor-stack name="systemStack">
<interceptor-ref name="paramsPrepareParamsStack"/>
</interceptor-stack>
</interceptors>
<!--3:将我们定义的拦截器栈,设置为默认的拦截器 -->
<default-interceptor-ref name="systemStack"/>
<!-- 定义全局的视图 -->
<global-results>
<result name="login" type="redirect">
/login.jsp
</result>
<result name="Forbidden">
/forbidden.jsp
</result>
<result name="error">
/error.jsp
</result>
</global-results>
<!-- <global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"/>
</global-exception-mappings> -->
<action name="user_*" class="cn.itcast.cd.action.UserAction" method="{1}">
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
<action name="login" class="cn.itcast.cd.action.LoginAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result name="login">
/login.jsp
</result>
<result type="redirectAction">
<param name="actionName">main</param>
</result>
</action>
<action name="logout" class="cn.itcast.cd.action.LogoutAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result type="redirect">
/login.jsp
</result>
</action>
<action name="game_*" class="cn.cid.cd.action.GameInfoAction" method="{1}">
<result name="input">
/houtai_game_add.jsp
</result>
<result name="list">
/houtai_game_list.jsp
</result>
<result name="save" type="redirectAction">
game_list
</result>
<result name="delete" type="redirectAction">
game_list
</result>
<result name="get">
/gameInfo.jsp
</result>
<result name="logo" type="redirectAction">
game_list
</result>
</action>
<action name="dev_*" class="cn.cid.cd.action.DevloperAction" method="{1}">
<result name="input">
/houtai_dev_add.jsp
</result>
<result name="list">
/houtai_dev_list.jsp
</result>
<result name="save" type="redirectAction">
dev_list
</result>
<result name="delete" type="redirectAction">
dev_list
</result>
</action>
<action name="style_*" class="cn.cid.cd.action.GameStyleAction" method="{1}">
<result name="input">
/houtai_style_add.jsp
</result>
<result name="list">
/houtai_style_list.jsp
</result>
<result name="save" type="redirectAction">
style_list
</result>
<result name="delete" type="redirectAction">
style_list
</result>
</action>
<action name="sdk_*" class="cn.cid.cd.action.SDKVersionAction" method="{1}">
<result name="input">
/houtai_sdk_add.jsp
</result>
<result name="list">
/houtai_sdk_list.jsp
</result>
<result name="save" type="redirectAction">
sdk_list
</result>
<result name="delete" type="redirectAction">
sdk_list
</result>
</action>
<action name="image_*" class="cn.cid.cd.action.GameImageAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/houtai_img_list.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="query">
/show_img.jsp
</result>
</action>
<action name="forum_*" class="cn.cid.cd.action.ForumAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/enjoy.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="hotest">
/show_img.jsp
</result>
<result name="childlist">
/page3.jsp
</result>
</action>
</package>
web.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
<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>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>cn.cid.cd.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application.xml</param-value>
</context-param>
</web-app>
linux下tomcat的server.xml配置
<Context path="/wxcs" docBase="webapps/wxcs" debug="0" reloadable="true" privileged="true">
-----------------------------------------------------
下面是我的访问路径:
http://主机名:8080/wxcs/game_list
我是有LIST这个方法的哈.并且对应的JSP视图都直接在wxcs这个项目的根目录下面.项目也已经放在tomcat的webapps下面.叫wxcs
<struts>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.devMode" value="false"></constant>
<constant name="struts.objectFactory" value="spring"></constant>
<constant name="struts.ui.theme" value="simple"></constant>
<package name="default" namespace="/" extends="struts-default">
<interceptors>
<!--1 注册自定义的拦截器. -->
<interceptor name="loginCheck" class="cn.cid.cd.action.interceptor.LoginInterceptor"/>
<!--2 注册一个拦截器栈,向里面添加单个的拦截器. -->
<interceptor-stack name="systemStack">
<interceptor-ref name="paramsPrepareParamsStack"/>
</interceptor-stack>
</interceptors>
<!--3:将我们定义的拦截器栈,设置为默认的拦截器 -->
<default-interceptor-ref name="systemStack"/>
<!-- 定义全局的视图 -->
<global-results>
<result name="login" type="redirect">
/login.jsp
</result>
<result name="Forbidden">
/forbidden.jsp
</result>
<result name="error">
/error.jsp
</result>
</global-results>
<!-- <global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"/>
</global-exception-mappings> -->
<action name="user_*" class="cn.itcast.cd.action.UserAction" method="{1}">
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
<action name="login" class="cn.itcast.cd.action.LoginAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result name="login">
/login.jsp
</result>
<result type="redirectAction">
<param name="actionName">main</param>
</result>
</action>
<action name="logout" class="cn.itcast.cd.action.LogoutAction">
<interceptor-ref name="paramsPrepareParamsStack"></interceptor-ref>
<result type="redirect">
/login.jsp
</result>
</action>
<action name="game_*" class="cn.cid.cd.action.GameInfoAction" method="{1}">
<result name="input">
/houtai_game_add.jsp
</result>
<result name="list">
/houtai_game_list.jsp
</result>
<result name="save" type="redirectAction">
game_list
</result>
<result name="delete" type="redirectAction">
game_list
</result>
<result name="get">
/gameInfo.jsp
</result>
<result name="logo" type="redirectAction">
game_list
</result>
</action>
<action name="dev_*" class="cn.cid.cd.action.DevloperAction" method="{1}">
<result name="input">
/houtai_dev_add.jsp
</result>
<result name="list">
/houtai_dev_list.jsp
</result>
<result name="save" type="redirectAction">
dev_list
</result>
<result name="delete" type="redirectAction">
dev_list
</result>
</action>
<action name="style_*" class="cn.cid.cd.action.GameStyleAction" method="{1}">
<result name="input">
/houtai_style_add.jsp
</result>
<result name="list">
/houtai_style_list.jsp
</result>
<result name="save" type="redirectAction">
style_list
</result>
<result name="delete" type="redirectAction">
style_list
</result>
</action>
<action name="sdk_*" class="cn.cid.cd.action.SDKVersionAction" method="{1}">
<result name="input">
/houtai_sdk_add.jsp
</result>
<result name="list">
/houtai_sdk_list.jsp
</result>
<result name="save" type="redirectAction">
sdk_list
</result>
<result name="delete" type="redirectAction">
sdk_list
</result>
</action>
<action name="image_*" class="cn.cid.cd.action.GameImageAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/houtai_img_list.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="query">
/show_img.jsp
</result>
</action>
<action name="forum_*" class="cn.cid.cd.action.ForumAction" method="{1}">
<result name="input">
/houtai_img_add.jsp
</result>
<result name="list">
/enjoy.jsp
</result>
<result name="save">
/show_img.jsp
</result>
<result name="delete" type="redirectAction">
img_list
</result>
<result name="hotest">
/show_img.jsp
</result>
<result name="childlist">
/page3.jsp
</result>
</action>
</package>
web.xml配置文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<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>
<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>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>cn.cid.cd.servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:application.xml</param-value>
</context-param>
</web-app>
linux下tomcat的server.xml配置
<Context path="/wxcs" docBase="webapps/wxcs" debug="0" reloadable="true" privileged="true">
-----------------------------------------------------
下面是我的访问路径:
http://主机名:8080/wxcs/game_list
我是有LIST这个方法的哈.并且对应的JSP视图都直接在wxcs这个项目的根目录下面.项目也已经放在tomcat的webapps下面.叫wxcs
#3
<constant name="
struts.objectFactory" value="
spring"></constant>
交给spring管理了。
<action name="user_*" class=" cn.itcast.cd.action.UserAction" method="{1}">
class的值和spring里的bean的name值保持一致
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
交给spring管理了。
<action name="user_*" class=" cn.itcast.cd.action.UserAction" method="{1}">
class的值和spring里的bean的name值保持一致
<result name="input">
WEB-INF/jsp/product_editer.jsp
</result>
<result type="redirectAction">
user_list
</result>
<result name="list">
WEB-INF/jsp/product.jsp
</result>
</action>
<action name="main" class="cn.itcast.cd.action.MainAction">
<result name="success">
WEB-INF/jsp/main.jsp
</result>
</action>
#4
此问题怎么解决的啊,我也遇到同样的问题了
#5
防火墙关闭了吗
#6
我就是怕防火墙有问题,干脆没装防火墙
#7
此问题尚未解决,求大神帮助
#8
1.首先确定项目加载到了配置文件了没。2.加载报错了没。
#9
报404错误,在web.xml中去掉strust的配置文件后,就正常了,想用strust不知道怎么办
#10
求助啊,jsp未能加载成功,怎么办?