- 浏览: 485756 次
- 性别:
- 来自: 武汉
最新评论
-
zyzyzy123:
请问有工程吗,我现在正在实现打电话的功能,但是一直不通,怀疑是 ...
实用的java 串口通信程序 -
wuhaitong:
引用[img][/img][*][url][/url] ...
jbpm -
迷糊_le:
maven命令, 蛮好的,谢谢
maven eclipse -
Wuaner:
不错的文章 , 谢谢分享!
Hadoop -
yuqihengsheng:
strong 很细
HighLighter
听说struts2出来了,与webwork2的差别也不是很大,robbin说迁移很easy,禁不住诱惑,我也尝试了一把,然则发现其实好像没那么容易啊,下面把一些过程记下来。
1、JDK版本,首先我们用的是JDK1.4,一直不太敢使用JDK5,因为我们开发的系统很有可能还要在用户很久以前的系统上跑,怕出兼容问题,所以struts2我们只能选用其jdk4的那个版本了。放入的jar是:
xwork-j4-2.0.1.jar、struts2-core-j4-2.0.6.jar、retrotranslator-transformer-1.2.0.jar、retrotranslator-runtime-1.2.0.jar、backport-util-concurrent-3.0.jar
2、受到一个jar包的名字的引诱,就是struts2-spring-plugin-2.0.6.jar,于是将这个jar放到了lib中,出现了版本不兼容的异常,系统不能启动,于是找到源码,用jdk4重新编译了一下,好了。然后将struts-plugin.xml也放到了classes下面。这时候还是一直启动不了。郁闷。非常郁闷,找到以前的项目不停的对比。最后发现struts2-spring-plugin-2.0.6.jar这个jar完全没用,也就是说里面的那个类StrutsSpringObjectFactory对系统来说是没用的。删掉,然后将struts-plugin.xml也删掉了。最后的各种配置文件如下:
- ### Struts default properties
- ###(can be overridden by a struts.properties file in the root of the classpath)
- ###
- ### Specifies the Configuration used to configure Struts
- ### one could extend org.apache.struts2.config.Configuration
- ### to build one's customize way of getting the configurations parameters into Struts
- # struts.configuration=org.apache.struts2.config.DefaultConfiguration
- ### This can be used to set your default locale and encoding scheme
- # struts.locale=en_US
- struts.i18n.encoding=UTF-8
- ### if specified, the default object factory can be overridden here
- ### Note: short-hand notation is supported in some cases, such as "spring"
- ### Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here
- #struts.objectFactory = spring
- #上面这句一定要注释掉。
- ### specifies the autoWiring logic when using the SpringObjectFactory.
- ### valid values are: name, type, auto, and constructor (name is the default)
- struts.objectFactory.spring.autoWire = name
- ### indicates to the struts-spring integration if Class instances should be cached
- ### this should, until a future Spring release makes it possible, be left as true
- ### unless you know exactly what you are doing!
- ### valid values are: true, false (true is the default)
- struts.objectFactory.spring.useClassCache = true
- ### if specified, the default object type determiner can be overridden here
- ### Note: short-hand notation is supported in some cases, such as "tiger" or "notiger"
- ### Alternatively, you can provide a com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation name here
- ### Note: if you have the xwork-tiger.jar within your classpath, GenericsObjectTypeDeterminer is used by default
- ### To disable tiger support use the "notiger" property value here.
- #struts.objectTypeDeterminer = tiger
- #struts.objectTypeDeterminer = notiger
- ### Parser to handle HTTP POST requests, encoded using the MIME-type multipart/form-data
- # struts.multipart.parser=cos
- # struts.multipart.parser=pell
- struts.multipart.parser=jakarta
- # uses javax.servlet.context.tempdir by default
- struts.multipart.saveDir=
- struts.multipart.maxSize=2097152
- ### Load custom property files (does not override struts.properties!)
- # struts.custom.properties=application,org/apache/struts2/extension/custom
- ### How request URLs are mapped to and from actions
- #struts.mapper.class=org.apache.struts2.dispatcher.mapper.DefaultActionMapper
- ### Used by the DefaultActionMapper
- ### You may provide a comma separated list, e.g. struts.action.extension=action,jnlp,do
- struts.action.extension=action
- ### Used by FilterDispatcher
- ### If true then Struts serves static content from inside its jar.
- ### If false then the static content must be available at <context_path></context_path>/struts
- struts.serve.static=true
- ### Used by FilterDispatcher
- ### This is good for development where one wants changes to the static content be
- ### fetch on each request.
- ### NOTE: This will only have effect if struts.serve.static=true
- ### If true -> Struts will write out header for static contents such that they will
- ### be cached by web browsers (using Date, Cache-Content, Pragma, Expires)
- ### headers).
- ### If false -> Struts will write out header for static contents such that they are
- ### NOT to be cached by web browser (using Cache-Content, Pragma, Expires
- ### headers)
- struts.serve.static.browserCache=true
- ### Set this to false if you wish to disable implicit dynamic method invocation
- ### via the URL request. This includes URLs like foo!bar.action, as well as params
- ### like method:bar (but not action:foo).
- ### An alternative to implicit dynamic method invocation is to use wildcard
- ### mappings, such as <action></action>"*/*" method="{2}" class="actions.{1}">
- struts.enable.DynamicMethodInvocation = true
- ### Set this to true if you wish to allow slashes in your action names. If false,
- ### Actions names cannot have slashes, and will be accessible via any directory
- ### prefix. This is the traditional behavior expected of WebWork applications.
- ### Setting to true is useful when you want to use wildcards and store values
- ### in the URL, to be extracted by wildcard patterns, such as
- ### <action></action>"*/*" method="{2}" class="actions.{1}"> to match "/foo/edit" or
- ### "/foo/save".
- struts.enable.SlashesInActionNames = false
- ### use alternative syntax that requires %{} in most places
- ### to evaluate expressions for String attributes for tags
- struts.tag.altSyntax=true
- ### when set to true, Struts will act much more friendly for developers. This
- ### includes:
- ### - struts.i18n.reload = true
- ### - struts.configuration.xml.reload = true
- ### - raising various debug or ignorable problems to errors
- ### For example: normally a request to foo.action?someUnknownField=true should
- ### be ignored (given that any value can come from the web and it
- ### should not be trusted). However, during development, it may be
- ### useful to know when these errors are happening and be told of
- ### them right away.
- struts.devMode = true
- ### when set to true, resource bundles will be reloaded on _every_ request.
- ### this is good during development, but should never be used in production
- struts.i18n.reload=true
- ### Standard UI theme
- ### Change this to reflect which path should be used for JSP control tag templates by default
- struts.ui.theme=jsxhtml
- struts.ui.templateDir=template
- #sets the default template type. Either ftl, vm, or jsp
- struts.ui.templateSuffix=ftl
- ### Configuration reloading
- ### This will cause the configuration to reload struts.xml when it is changed
- struts.configuration.xml.reload=true
- ### Location of velocity.properties file. defaults to velocity.properties
- ###struts.velocity.configfile = velocity.properties
- ### Comma separated list of VelocityContext classnames to chain to the StrutsVelocityContext
- ###struts.velocity.contexts =
- ### Location of the velocity toolbox
- ###struts.velocity.toolboxlocation=
- ### used to build URLs, such as the UrlTag
- struts.url.http.port = 80
- struts.url.https.port = 443
- ### possible values are: none, get or all
- struts.url.includeParams = get
- ### Load custom default resource bundles
- # struts.custom.i18n.resources=testmessages,testmessages2
- ### workaround for some app servers that don't handle HttpServletRequest.getParameterMap()
- ### often used for WebLogic, Orion, and OC4J
- struts.dispatcher.parametersWorkaround = false
- ### configure the Freemarker Manager class to be used
- ### Allows user to plug-in customised Freemarker Manager if necessary
- ### MUST extends off org.apache.struts2.views.freemarker.FreemarkerManager
- #struts.freemarker.manager.classname=org.apache.struts2.views.freemarker.FreemarkerManager
- ### See the StrutsBeanWrapper javadocs for more information
- struts.freemarker.wrapper.altMap=true
- ### configure the XSLTResult class to use stylesheet caching.
- ### Set to true for developers and false for production.
- struts.xslt.nocache=false
- ### A list of configuration files automatically loaded by Struts
- struts.configuration.files=struts-default.xml,struts.xml
- #不能加载struts-plugin.xml,在classpath下面也不能有这个文件
- ### Whether to always select the namespace to be everything before the last slash or not
- struts.mapper.alwaysSelectFullNamespace=false
- <?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>
- <include file="struts-default.xml" />
- <include file="struts-application.xml" />
- <include file="struts-common.xml" />
- <include file="struts-dym.xml" />
- <include file="struts-zxw.xml" />
- <include file="struts-hw.xml" />
- <include file="struts-zw.xml" />
- <include file="struts-lb.xml" />
- <include file="struts-lx.xml" />
- <include file="struts-cjh.xml" />
- <include file="struts-wyf.xml" />
- </struts>
- <?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>
- <package name="default" extends="struts-default">
- <interceptors>
- <!-- Interceptor to catch exceptions and display mapped exception result -->
- <interceptor name="exceptionHandler" class="com.broadtext.framework.web.interceptor.ExceptionHandleInterceptor" />
- <interceptor name="authorizationHandler" class="com.broadtext.framework.web.interceptor.AuthorizationInterceptor" />
- <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/>
- <interceptor-stack name="appDefaultStack">
- <interceptor-ref name="autowiring"/>
- <interceptor-ref name="exception"/>
- <interceptor-ref name="alias"/>
- <interceptor-ref name="servlet-config"/>
- <interceptor-ref name="prepare"/>
- <interceptor-ref name="chain"/>
- <interceptor-ref name="model-driven"/>
- <interceptor-ref name="fileUpload"/>
- <interceptor-ref name="static-params"/>
- <interceptor-ref name="params"/>
- <interceptor-ref name="conversionError"/>
- <interceptor-ref name="exceptionHandler" />
- <interceptor-ref name="authorizationHandler" />
- </interceptor-stack>
- </interceptors>
- <default-interceptor-ref name="appDefaultStack" />
- <global-results>
- <result name="appBaseError">/pages/common/appBaseError.jsp</result>
- <result name="runtimeError">/pages/common/runtimeError.jsp</result>
- <result name="unkownError">/pages/common/runtimeError.jsp</result>
- </global-results>
- </package>
- </struts>
- <bean id="userService" class="com.broadtext.cmshzhgl.security.service.impl.UserServiceImpl">
- <property name="dao" ref="baseDao"></property>
- <property name="utilService" ref="utilService"></property>
- <property name="roleService" ref="roleService"></property>
- </bean>
- public class LoginAction extends BaseAction {
- private UserService userService;
- public String login(){
- String aaa = userService.getTestString();
- System.out.println(aaa);
- return SUCCESS;
- }
- public void setUserService(UserService userService) {
- this.userService = userService;
- }
- }
- <?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>
- <package name="test" extends="default" namespace="/pages/test">
- <action name="login" class="com.broadtext.cmshzhgl.security.action.LoginAction" method="login">
- <result name="success">/pages/common/currentUser.jsp</result>
- </action>
- </package>
- </struts>
总体感觉是:对于具体的开发业务的配置,xwork.xml变到struts.xml比较简单,但是spring如何注入还是比较麻烦的,要改几个文件的内容,而不是简单的将webwork和xwork改成struts就ok,主要问题struts提供了好几种spring注入的选择,弄得有些犯晕。上面我只列出其中一种配置方案,更多的配置方法慢慢再体验吧。
发表评论
-
安装和使用memcached
2014-04-16 16:24 644如何将 memcached 融入到 ... -
applicationContext.xml
2013-08-09 09:05 947<?xml version="1.0&quo ... -
注释驱动的 Spring cache 缓存介绍
2013-08-08 07:04 664概述 Spring 3.1 引入了激动人心的基于注释(an ... -
Spring2.5 Annotations
2013-08-08 06:33 862完成setXxxx功能,即配置文件的 <propert ... -
Spring基于注解的缓存配置--EHCache AND OSCache
2013-08-07 23:21 1031本文将构建一个普通工程来说明spring注解缓存的使用方式, ... -
Ehcache 整合Spring 使用页面、对象缓存
2013-08-07 22:51 898Ehcache 整合Spring 使用页面、对象缓存 ... -
javassist教程和示例
2013-05-18 08:57 2014Javassist是一个执行字节 ... -
ZooKeeper官方文档
2013-05-16 17:09 1563介绍(源自ZooKeeper官方文档) 学习HBase过程 ... -
ZooKeeper -例子
2013-05-16 17:08 1217ZooKeeper ZooKeepe ... -
Spring整合Hessian访问远程服务
2013-05-15 13:44 860Spring整合Hessian访问远程服务 目录 1.1 ... -
redis
2013-05-14 11:44 773redis是一个key-value存储系统。和Memcach ... -
spring 资源访问
2013-05-13 08:26 1003spring在java基础上封装了资源访问,简单易用。 R ... -
ZooKeeper——入门
2013-05-08 16:12 913ZooKeeper——入门 博客分类: ZooK ... -
分布式服务框架 Zookeeper -- 管理分布式环境中的数据(IBM)
2013-05-08 14:07 788安装和配置详解 本文 ... -
分布式协调服务---Zookeeper
2013-05-08 14:05 7781、Zookeeper overview Zookee ... -
Hibernate
2013-03-28 13:04 926一、简述 Hibernate 和 JD ... -
Apache+Tomcat集群配置详解
2013-02-01 10:52 897Apache + Tomcat集群配置详解(1) 一、 ... -
Apache+Jboss集群基于反向代理的负载均衡
2013-02-01 10:40 2498假设三台机器IP分别为172.29.128.100、172. ... -
spring + ibatis 多数据源事务(分布式事务)管理配置方法
2012-12-17 15:18 1269spring + ibatis 多数据源事务(分布式事务 ... -
Hessian序列化不设SerializerFactory性能问题
2012-10-31 09:47 1503Hessian序列化不设SerializerFactor ...
相关推荐
Struts2是一款非常流行的Java Web框架,用于构建企业级应用。然而,随着时间的推移,Struts2在安全方面暴露出了一些重要的漏洞,这给使用该框架的系统带来了潜在的安全风险。"Struts2漏洞检查工具Struts2.2019.V2.3...
Struts2是一个强大的Java EE应用程序框架,主要用于构建企业级的Web应用。它的核心是MVC(Model-View-Controller)设计模式,可以帮助开发者组织代码,提高开发效率,并且提供了丰富的特性来支持表单验证、国际化、...
Struts2 项目开发 Struts2 是一个基于 Java Web 的框架,广泛应用于 Web 应用程序的开发。下面将从 Struts2 项目开发的角度,详细介绍 Struts2 框架的应用、开发流程、技术架构、实践经验等方面的知识点。 项目...
### Struts2核心知识点解析 #### 一、Struts2框架概述 - **定义与特点**:Struts2是一款基于MVC(Model-View-Controller)设计模式的Java Web应用程序框架,它继承了Struts1的优点,同时在设计上更加灵活、易用,...
struts2-core-2.0.1.jar, struts2-core-2.0.11.1.jar, struts2-core-2.0.11.2.jar, struts2-core-2.0.11.jar, struts2-core-2.0.12.jar, struts2-core-2.0.14.jar, struts2-core-2.0.5.jar, struts2-core-2.0.6.jar,...
该工具的打开路径为:\Struts2VulsTools-2.3.20190927\Test\bin\Release\Text.exe 2019-09-25: 优化部分EXP在部分情况下被WAF拦截的问题,提高检测成功率,优化自定义上传路径exp,文件所在目录不存在时自动创建...
Struts2是一个强大的Java web应用程序开发框架,它基于Model-View-Controller(MVC)设计模式,旨在简化创建用户交互式、数据驱动的web应用的过程。这个“Struts2接口文档”是开发者的重要参考资料,提供了关于...
Struts2-showcase是一个用于演示和学习Apache Struts2框架功能的开源项目。这个压缩包“struts2-showcase.rar”包含了完整的源代码,旨在帮助开发者深入理解Struts2框架的工作原理及其各种特性。以下是对Struts2和...
从给定的文件信息来看,标题“struts2中文学习文档”和描述“struts2的根本webwork2”表明这是一份关于Struts2框架的学习资料,特别强调了Struts2与WebWork2的关系。Struts2是Apache Struts的一个版本,它是一个用于...
"struts2 jar"文件包含了Struts2框架的核心库,可能包括struts2-core、struts2-convention、struts2-json-plugin等依赖,这些是开发Struts2应用必不可少的组件。 "Struts2"可能是项目实例代码,包括Action类、视图...
Struts2是一个非常著名的Java Web开发框架,由Apache软件基金会维护。它基于MVC(Model-View-Controller)设计模式,极大地简化了构建基于Java EE的Web应用程序的过程。本资源包含"struts2所有jar包程序文件",是...
-- 为修复struts2 s2-016、s2-017漏洞,重写DefaultActionMapper --> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="myDefaultActionMapper" class=...
Struts2是一个强大的Java web开发框架,用于构建可维护、可扩展且结构良好的应用程序。它在MVC(Model-View-Controller)设计模式的基础上提供了一种实现方式,使得开发者能够更方便地处理用户请求,控制业务逻辑,...
Struts2是Apache软件基金会下的一个开源框架,主要用于构建企业级的Java web应用程序。张龙圣思园的Struts2学习笔记,无疑为Java开发者提供了一份宝贵的参考资料,它可能涵盖了Struts2的基础概念、核心组件、配置...
struts2 chm 程序包 org.apache.struts2 接口概要 接口 说明 StrutsStatics Constants used by Struts. 类概要 类 说明 RequestUtils Request handling utility class. ServletActionContext Web-specific ...
包含struts2-core-2.5.10.1.jar,struts2-jfreechart-plugin-2.5.10.1.jar,struts2-json-plugin-2.5.10.1.jar,struts2-junit-plugin-2.5.10.1.jar,struts2-bean-validation-plugin-2.5.10.1.jar,struts2-cdi-...
整合使用最新版本的三大框架(即Struts2、Spring4和Hibernate4),搭建项目架构原型。 项目架构原型:Struts2.3.16 + Spring4.1.1 + Hibernate4.3.6。 此外,还有:log4j、slf4j、junit4、ehcache等知识点。 项目...
Struts 2是一款基于Java的开源MVC框架,它在Web应用开发中广泛使用,但同时也因其复杂的架构和历史遗留问题,成为了网络安全的焦点。这个标题提到的是一个全面的Struts 2漏洞检测工具,旨在帮助开发者和安全专家识别...
struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全struts2 总结工程大全...
Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试Struts2漏洞测试...