Struct2安装配置问题,谢谢了
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name>
<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>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
<package name="itcast" namespace="/test" extends="structs-default">
<action name="helloword" class="cn.itcast.action.HelloWorldAction" method="execute">
<result name="success">/WEB-INF/page/hello.jsp</result>
</action>
</package>
</struts>
[最优解释]
咳……你这还算好的……
之前配置hibernate4+spring3,hibernate4居然都不支持HibernateDaoSupport了……搞死人……整得我死去活来的……相比之下struts2算好对付的了。
这种配置的问题论坛上回答存在时间差。我发了私信给你,注意查看下。
[其他解释]
90分,我贡献80了哦。
希望有人能帮我解决这个问题。
1.完整版解压的时候有错误,于是我分别下的
2.先把6个jar包复制进入lib目录,(哦,有两个loging,我不懂,于是一起复制了),引用成“牛奶瓶(我们喜欢这样叫,呵呵)”
3.配置好web.xml
4.配置好struct.xml(提示说structs-default未定义)
启动说ClassNotFound
[其他解释]
如果想用annotation的注解还要拷贝struts2-convention-plugin-2.x.x.x.jar。
然后是web.xml:
<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>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true" />
<package name="globalSetup" extends="struts-default">
<global-results>
<result name="error">/error.html</result>
</global-results>
<global-exception-mappings>
<exception-mapping result="error" exception="java.lang.Exception"></exception-mapping>
</global-exception-mappings>
</package>
<package name="user" namespace="/user" extends="globalSetup" >
<action name="*_*" class="{1}Action" method="{2}">
<result name="addSuccess">sysmgr/user_maint.jsp</result>
</action>
</package>
</struts>