Struts2七日学(第一日)
第一日:
今天主要学习了Struts2的配置,和一些概念。
nameSpace Action 等
关于配置和使用到的jar文件,大家可以参考
struts-2.3.1.1\apps\struts2-blank.war (使用rar解压查看即可)
配置:
1)web.xml
关于需要的jar,个人觉得用到什么加什么,看出来什么错,缺了什么包,再加比较好
Errot:
java.lang.IllegalStateException: Must have the StrutsPrepareFilter execute before this one
这里要注意struts2使用的Filter是org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
struts2-core-2.3.1.jar
java.lang.NoClassDefFoundError: com/opensymphony/xwork2/ActionContext
xwork-core-2.3.1.jar
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
commons-lang-2.5.jar
java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils
基本需要的jar:
commons-fileupload-1.2.2.jar
commons-io-2.0.1.jar
commons-lang-2.5.jar
freemarker-2.3.18.jar
javassist-3.11.0.GA.jar
ognl-3.0.3.jar
struts2-core-2.3.1.jar
xwork-core-2.3.1.jar