- 浏览: 554606 次
- 性别:
- 来自: 武汉
文章分类
最新评论
-
bo_hai:
快速排序:https://bo-hai.iteye.com/b ...
插入排序、选择排序、冒泡排序 简单实例 -
bo_hai:
参考:https://bo-hai.iteye.com/blo ...
插入排序、选择排序、冒泡排序 简单实例 -
bo_hai:
JDK1.8后,解决问题的办法就简单啦:List<Int ...
List 中去除 null 方法讨论 -
bo_hai:
上述两种办法都不是最好的单例模式。
安全发布单例模式 -
bo_hai:
我来评论一下。
MySql 删除重复数据的方法
一、在使用struts2进行开发时,struts2默认支持的文件JSP。这点我们可以在 struts2-core-xxx.jar中 的struts-default.xml 中看到:
<result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" default="true"/>
我们可以看到struts2默认返回支持的文件类型是:org.apache.struts2.dispatcher.ServletDispatcherResult。
二、如果我们的项目显图层使用的文件是FTL,那么我们要如何修改struts2默认的返回类型呢?解决方案如下:
1)把struts-default.xml中的
<package name="struts-default" abstract="true">
全部copy到 工程中的struts.xml文件中。struts2.xml的内容如下:
<?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="base" extends="struts-default" abstract="true"> <result-types> <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/> <result-type name="dispatcher" class="org.apache.struts2.dispatcher.ServletDispatcherResult" /> <result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult" default="true"/> <result-type name="httpheader" class="org.apache.struts2.dispatcher.HttpHeaderResult"/> <result-type name="redirect" class="org.apache.struts2.dispatcher.ServletRedirectResult"/> <result-type name="redirectAction" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/> <result-type name="stream" class="org.apache.struts2.dispatcher.StreamResult"/> <result-type name="velocity" class="org.apache.struts2.dispatcher.VelocityResult"/> <result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/> <result-type name="plainText" class="org.apache.struts2.dispatcher.PlainTextResult" /> <result-type name="redirect-action" class="org.apache.struts2.dispatcher.ServletActionRedirectResult"/> <result-type name="plaintext" class="org.apache.struts2.dispatcher.PlainTextResult" /> </result-types> <interceptors> <interceptor name="alias" class="com.opensymphony.xwork2.interceptor.AliasInterceptor"/> <interceptor name="autowiring" class="com.opensymphony.xwork2.spring.interceptor.ActionAutowiringInterceptor"/> <interceptor name="chain" class="com.opensymphony.xwork2.interceptor.ChainingInterceptor"/> <interceptor name="conversionError" class="org.apache.struts2.interceptor.StrutsConversionErrorInterceptor"/> <interceptor name="cookie" class="org.apache.struts2.interceptor.CookieInterceptor"/> <interceptor name="createSession" class="org.apache.struts2.interceptor.CreateSessionInterceptor" /> <interceptor name="debugging" class="org.apache.struts2.interceptor.debugging.DebuggingInterceptor" /> <interceptor name="externalRef" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/> <interceptor name="execAndWait" class="org.apache.struts2.interceptor.ExecuteAndWaitInterceptor"/> <interceptor name="exception" class="com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor"/> <interceptor name="fileUpload" class="org.apache.struts2.interceptor.FileUploadInterceptor"/> <interceptor name="i18n" class="com.opensymphony.xwork2.interceptor.I18nInterceptor"/> <interceptor name="logger" class="com.opensymphony.xwork2.interceptor.LoggingInterceptor"/> <interceptor name="modelDriven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/> <interceptor name="scopedModelDriven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/> <interceptor name="params" class="com.opensymphony.xwork2.interceptor.ParametersInterceptor"/> <interceptor name="prepare" class="com.opensymphony.xwork2.interceptor.PrepareInterceptor"/> <interceptor name="staticParams" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/> <interceptor name="scope" class="org.apache.struts2.interceptor.ScopeInterceptor"/> <interceptor name="servletConfig" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/> <interceptor name="sessionAutowiring" class="org.apache.struts2.spring.interceptor.SessionContextAutowiringInterceptor"/> <interceptor name="timer" class="com.opensymphony.xwork2.interceptor.TimerInterceptor"/> <interceptor name="token" class="org.apache.struts2.interceptor.TokenInterceptor"/> <interceptor name="tokenSession" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/> <interceptor name="validation" class="org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor"/> <interceptor name="workflow" class="com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor"/> <interceptor name="store" class="org.apache.struts2.interceptor.MessageStoreInterceptor" /> <interceptor name="checkbox" class="org.apache.struts2.interceptor.CheckboxInterceptor" /> <interceptor name="profiling" class="org.apache.struts2.interceptor.ProfilingActivationInterceptor" /> <interceptor name="roles" class="org.apache.struts2.interceptor.RolesInterceptor" /> <!-- Basic stack --> <interceptor-stack name="basicStack"> <interceptor-ref name="exception"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="params"/> <interceptor-ref name="conversionError"/> </interceptor-stack> <!-- Sample validation and workflow stack --> <interceptor-stack name="validationWorkflowStack"> <interceptor-ref name="basicStack"/> <interceptor-ref name="validation"/> <interceptor-ref name="workflow"/> </interceptor-stack> <!-- Sample file upload stack --> <interceptor-stack name="fileUploadStack"> <interceptor-ref name="fileUpload"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample model-driven stack --> <interceptor-stack name="modelDrivenStack"> <interceptor-ref name="modelDriven"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample action chaining stack --> <interceptor-stack name="chainStack"> <interceptor-ref name="chain"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <!-- Sample i18n stack --> <interceptor-stack name="i18nStack"> <interceptor-ref name="i18n"/> <interceptor-ref name="basicStack"/> </interceptor-stack> <interceptor-stack name="paramsPrepareParamsStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="params"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="i18n"/> <interceptor-ref name="chain"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="params"/> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludeMethods">input,back,cancel</param> </interceptor-ref> </interceptor-stack> <interceptor-stack name="defaultStack"> <interceptor-ref name="exception"/> <interceptor-ref name="alias"/> <interceptor-ref name="servletConfig"/> <interceptor-ref name="prepare"/> <interceptor-ref name="i18n"/> <interceptor-ref name="chain"/> <interceptor-ref name="debugging"/> <interceptor-ref name="profiling"/> <interceptor-ref name="scopedModelDriven"/> <interceptor-ref name="modelDriven"/> <interceptor-ref name="fileUpload"/> <interceptor-ref name="checkbox"/> <interceptor-ref name="staticParams"/> <interceptor-ref name="params"> <param name="excludeParams">dojo\..*</param> </interceptor-ref> <interceptor-ref name="conversionError"/> <interceptor-ref name="validation"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> <interceptor-ref name="workflow"> <param name="excludeMethods">input,back,cancel,browse</param> </interceptor-ref> </interceptor-stack> <!-- The completeStack is here for backwards compatibility for applications that still refer to the defaultStack by the old name --> <interceptor-stack name="completeStack"> <interceptor-ref name="defaultStack"/> </interceptor-stack> <!-- Sample execute and wait stack. Note: execAndWait should always be the *last* interceptor. --> <interceptor-stack name="executeAndWaitStack"> <interceptor-ref name="execAndWait"> <param name="excludeMethods">input,back,cancel</param> </interceptor-ref> <interceptor-ref name="defaultStack"/> <interceptor-ref name="execAndWait"> <param name="excludeMethods">input,back,cancel</param> </interceptor-ref> </interceptor-stack> <!-- Deprecated name forms scheduled for removal in Struts 2.1.0. The camelCase versions are preferred. See ww-1707 --> <interceptor name="external-ref" class="com.opensymphony.xwork2.interceptor.ExternalReferencesInterceptor"/> <interceptor name="model-driven" class="com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor"/> <interceptor name="static-params" class="com.opensymphony.xwork2.interceptor.StaticParametersInterceptor"/> <interceptor name="scoped-model-driven" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor"/> <interceptor name="servlet-config" class="org.apache.struts2.interceptor.ServletConfigInterceptor"/> <interceptor name="token-session" class="org.apache.struts2.interceptor.TokenSessionStoreInterceptor"/> </interceptors> <default-interceptor-ref name="defaultStack"/> </package> </struts>
2)一般情况下,我们会把上面的文件命名方struts-base.xml,然后在struts.xml 引入上面的文件:struts.xml的内容如下:
<?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.locale" value="zh_CN"/> <constant name="struts.i18n.encoding" value="UTF-8"/> <constant name="struts.objectFactory" value="spring" /> <constant name="struts.ui.theme" value="simple"/> <constant name="struts.action.extension" value="action" /> <constant name="struts.devMode" value="true"/> <constant name="struts.i18n.reload" value="true"/> <include file="struts-base.xml" /> <!-- <include file="META-INF/webapp/struts-test.xml" /> --> </struts>
3)struts.xml 还可以引入struts-test.xml等文件。
发表评论
-
nginx 配置 CORS 支持跨域访问
2014-11-11 20:26 11540CSS代码设置了一些字体,如果跨域访问这些字体,就会加载失败 ... -
lockInterruptibly 和lock的区别
2014-09-03 11:04 3213这是个被无数人写过并还会被其他人继续写下去的blog。 代 ... -
Spring MVC 的单元测试实例
2014-08-15 16:48 833一、先定义实例: public class BaseTes ... -
HTTPClient 简单使用
2014-08-15 13:47 1064HttpClient 的用模拟http请求的工具,一般用在 ... -
tomcat 配置虚拟主机实例
2014-07-29 14:20 1439一、先来解释一下虚拟主机的概念:在一个tomcat上放多个工 ... -
Eclipse3.6 安装EGit
2014-07-08 21:56 537Eclipse3.6 安装EGit地址是 http://do ... -
ThreadPoolExecutor 中饱和策略分析
2014-07-03 15:25 2195import java.util.concurrent.Ti ... -
FutureTask 实例
2014-06-29 10:56 606先来总结一下FutureTask使用场景: 如果不想分支线 ... -
ReadWriteLock 使用实例
2014-06-28 20:21 819首先来讨论ReadWriteLock 类的使用场景,记住一句 ... -
安全发布单例模式
2014-06-27 17:24 6211、最简单的方法: public class Singl ... -
JAVA notifyAll wait 实例
2014-06-27 13:55 481两个线程,分别有两数据结构:1到10的数据和A到E的字符。 ... -
获取机器CPU数量的方法
2014-06-22 15:58 534public class CPUNum { /** ... -
动态代理的实现
2014-06-17 21:26 450public interface IHelloWorld ... -
线程同步优化实例
2014-06-11 17:56 498代码如下: package com.bohai.thre ... -
JavaScript 遍历JSON 获取key value
2014-04-30 16:20 560if (!$.isEmptyObject(subProdIn ... -
计算器算法(支持加减乘除括号)
2014-04-19 17:53 5554import java.util.ArrayList; i ... -
实用工具类 && CollectionUtils
2014-04-19 13:53 7819import java.util.ArrayList; ... -
解决fatal: unable to connect to github.com问题
2014-04-08 16:43 2165问题: 在使用Aptana Studio3 ... -
JAVA多线程 Semaphore 应用
2014-01-24 16:04 483import java.util.concurrent.Ex ... -
JAVA多线程 Exchanger 应用
2014-01-24 15:42 618import java.util.concurrent.Ex ...
相关推荐
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,...
struts2-spring-plugin-2.3.15.2.jar ; struts2-json-plugin-2.3.16.3.jarstruts2-spring-plugin-2.3.15.2.jar ; struts2-json-plugin-2.3.16.3.jar
赠送jar包:struts2-json-plugin-2.3.24.jar; 赠送原API文档:struts2-json-plugin-2.3.24-javadoc.jar; 赠送源代码:struts2-json-plugin-2.3.24-sources.jar; 赠送Maven依赖信息文件:struts2-json-plugin-...
struts2-json-plugin,Struts JSON插件
struts2-ssl-plugin-1.2.1.jar
struts2-convention-plugin-2.3.32
struts2-dojo-plugin-2.3.4 jar 日期控件的jar包 需要的自行下载
struts2-convention-plugin-2.3.15.1.jar
struts2-core-2.2.3.1-sources.jar struts2-core-2.2.3.1-sources.jar struts2-core-2.2.3.1-sources.jar
struts2-convention-plugin-2.3.24.1
struts2-dojo-plugin-2.2.1.jar, 直接导入到Struts2项目里即可,注意版本。
默认的struts2-config-browser-plugin包中的ftl文件include标签路径用的相对路径,会找到包内的include文件,将包内ftl里include的路径改成的/开头的全路径。
struts2-dojo-plugin-2.3.15.3.jar.zip
struts2-core-2.5.18.jar包下载,支持struts2的类库下载
struts2-core-2.5.10.jar ,struts核心包,struts2-core-2.5.10.jar
struts2-jquery-plugin-3.1.0.jar
struts2-jfreechart-plugin-2.1.8.1.jar
struts2-convention-plugin-2.1.6.jar
struts2的jar之一struts2-core-2.0.14.jar
struts2-core-2.0.12.jar