struts2配置文件名称|在struts2应用中请问能否修改配置文件名称 比如:默认的配置文件名为strutsxml改为mystrutsxml

❶ 简述Struts2的配置文件包括哪些元素

1、package元素package用来管理action:使用了面向对象的思想属性:name:用来定义包名,注意:同一个配置文件中包名是唯一的。extends:指定所继承的包,一般情况下需要继承struts-default包 truts-default.xml中定义着struts-default这个包。 truts-default.xml是在我们的struts.xml加载之前加载。abstract:指定包是抽象的,只能被继承,含有action的包不能是抽象的,默认值是false。namespace:名称空间 名称空间 + 动作名称 = 访问路径<package name="p1" extends="struts-default" namespace="/a/b"></package>1struts2查找动作的方法:1:先按照用户输入的路径查找路径: /a/b/c/d/action1.action如果没有找到再向上一层路径找:/a/b/c 找到了(不会再继续向上找)该路径则执行第二步再向上一层路径找:/a/b 找到了(不会再继续向上找)该路径则执行第二步,找不到继续向上一级找再向上一层路径找:/a 没找到 找到了(不会再继续向上找)该路径则执行第二步再找/ 也没有的话去默认命名空间下找。都没找到直接报错 2:找action: 先在当前的命名空间下找 ,如果没有找到则取默认的命名空间(没有写namespace属性的)下找 ,如果还找不到报错一般只要我们有默认命名空间的pakege标签时,第一步是不会报错的。

❷ Struts2 配置文件标签问题

在struts的配置文件中的形式为:<constant name="struts.i18n.encoding" value="UTF-8" />struts.action.extensionThe URL extension to use to determine if the request is meant for a Struts action用URL扩展名来确定是否这个请求是被用作Struts action,其实也就是设置 action的后缀,例如login.do的'do'字。struts.configurationThe org.apache.struts2.config.Configuration implementation classorg.apache.struts2.config.Configuration接口名struts.configuration.filesA list of configuration files automatically loaded by Strutsstruts自动加载的一个配置文件列表struts.configuration.xml.reloadWhether to reload the XML configuration or not是否加载xml配置(true,false)struts.continuations.packageThe package containing actions that use Rife continuations含有actions的完整连续的package名称struts.custom.i18n.resourcesLocation of additional localization properties files to load加载附加的国际化属性文件(不包含.properties后缀)struts.custom.propertiesLocation of additional configuration properties files to load加载附加的配置文件的位置struts.devModeWhether Struts is in development mode or not是否为struts开发模式struts.dispatcher.parametersWorkaroundWhether to use a Servlet request parameter workaround necessary for some versions of WebLogic(某些版本的weblogic专用)是否使用一个servlet请求参数工作区(PARAMETERSWORKAROUND)struts.enable.DynamicMethodInvocationAllows one to disable dynamic method invocation from the URL允许动态方法调用struts.freemarker.manager.classnameThe org.apache.struts2.views.freemarker.FreemarkerManager implementation classorg.apache.struts2.views.freemarker.FreemarkerManager接口名struts.i18n.encodingThe encoding to use for localization messages国际化信息内码struts.i18n.reloadWhether the localization messages should automatically be reloaded是否国际化信息自动加载struts.localeThe default locale for the Struts application默认的国际化地区信息struts.mapper.classThe org.apache.struts2.dispatcher.mapper.ActionMapper implementation classorg.apache.struts2.dispatcher.mapper.ActionMapper接口struts.multipart.maxSizeThe maximize size of a multipart request (file upload)multipart请求信息的最大尺寸(文件上传用)struts.multipart.parserThe org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation for a multipart request (file upload)专为multipart请求信息使用的 org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文件上传用)struts.multipart.saveDirThe directory to use for storing uploaded files设置存储上传文件的目录夹struts.objectFactoryThe com.opensymphony.xwork2.ObjectFactory implementation classcom.opensymphony.xwork2.ObjectFactory接口(spring)struts.objectFactory.spring.autoWireWhether Spring should autoWire or not是否自动绑定Springstruts.objectFactory.spring.useClassCacheWhether Spring should use its class cache or not是否spring应该使用自身的cachestruts.objectTypeDeterminerThe com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation classcom.opensymphony.xwork2.util.ObjectTypeDeterminer接口struts.serve.static.browserCacheIf static content served by the Struts filter should set browser caching header properties or not是否struts过滤器中提供的静态内容应该被浏览器缓存在头部属性中struts.serve.staticWhether the Struts filter should serve static content or not是否struts过滤器应该提供静态内容struts.tag.altSyntaxWhether to use the alterative syntax for the tags or not是否可以用替代的语法替代tagsstruts.ui.templateDirThe directory containing UI templatesUI templates的目录夹struts.ui.themeThe default UI template theme默认的UI template主题struts.url.http.portThe HTTP port used by Struts URLs设置http端口struts.url.https.portThe HTTPS port used by Struts URLs设置https端口struts.url.includeParamsThe default includeParams method to generate Struts URLs在url中产生 默认的includeParamsstruts.velocity.configfileThe Velocity configuration file pathvelocity配置文件路径struts.velocity.contextsList of Velocity context namesvelocity的context列表struts.velocity.manager.classnameorg.apache.struts2.views.velocity.VelocityManager implementation classorg.apache.struts2.views.velocity.VelocityManager接口名struts.velocity.toolboxlocationThe location of the Velocity toolboxvelocity工具盒的位置struts.xslt.nocacheWhether or not XSLT templates should not be cached是否XSLT模版应该被缓存【原创】struts2的struts.properties配置文件详解struts.action.extensionThe URL extension to use to determine if the request is meant for a Struts action用URL扩展名来确定是否这个请求是被用作Struts action,其实也就是设置 action的后缀,例如login.do的'do'字。struts.configurationThe org.apache.struts2.config.Configuration implementation classorg.apache.struts2.config.Configuration接口名struts.configuration.filesA list of configuration files automatically loaded by Strutsstruts自动加载的一个配置文件列表struts.configuration.xml.reloadWhether to reload the XML configuration or not是否加载xml配置(true,false)struts.continuations.packageThe package containing actions that use Rife continuations含有actions的完整连续的package名称struts.custom.i18n.resourcesLocation of additional localization properties files to load加载附加的国际化属性文件(不包含.properties后缀)struts.custom.propertiesLocation of additional configuration properties files to load加载附加的配置文件的位置struts.devModeWhether Struts is in development mode or not是否为struts开发模式struts.dispatcher.parametersWorkaroundWhether to use a Servlet request parameter workaround necessary for some versions of WebLogic(某些版本的weblogic专用)是否使用一个servlet请求参数工作区(PARAMETERSWORKAROUND)struts.enable.DynamicMethodInvocationAllows one to disable dynamic method invocation from the URL允许动态方法调用struts.freemarker.manager.classnameThe org.apache.struts2.views.freemarker.FreemarkerManager implementation classorg.apache.struts2.views.freemarker.FreemarkerManager接口名struts.i18n.encodingThe encoding to use for localization messages国际化信息内码struts.i18n.reloadWhether the localization messages should automatically be reloaded是否国际化信息自动加载struts.localeThe default locale for the Struts application默认的国际化地区信息struts.mapper.classThe org.apache.struts2.dispatcher.mapper.ActionMapper implementation classorg.apache.struts2.dispatcher.mapper.ActionMapper接口struts.multipart.maxSizeThe maximize size of a multipart request (file upload)multipart请求信息的最大尺寸(文件上传用)struts.multipart.parserThe org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation for a multipart request (file upload)专为multipart请求信息使用的 org.apache.struts2.dispatcher.multipart.MultiPartRequest解析器接口(文件上传用)struts.multipart.saveDirThe directory to use for storing uploaded files设置存储上传文件的目录夹struts.objectFactoryThe com.opensymphony.xwork2.ObjectFactory implementation classcom.opensymphony.xwork2.ObjectFactory接口(spring)struts.objectFactory.spring.autoWireWhether Spring should autoWire or not是否自动绑定Springstruts.objectFactory.spring.useClassCacheWhether Spring should use its class cache or not是否spring应该使用自身的cachestruts.objectTypeDeterminerThe com.opensymphony.xwork2.util.ObjectTypeDeterminer implementation classcom.opensymphony.xwork2.util.ObjectTypeDeterminer接口struts.serve.static.browserCacheIf static content served by the Struts filter should set browser caching header properties or not是否struts过滤器中提供的静态内容应该被浏览器缓存在头部属性中struts.serve.staticWhether the Struts filter should serve static content or not是否struts过滤器应该提供静态内容struts.tag.altSyntaxWhether to use the alterative syntax for the tags or not是否可以用替代的语法替代tagsstruts.ui.templateDirThe directory containing UI templatesUI templates的目录夹struts.ui.themeThe default UI template theme默认的UI template主题struts.url.http.portThe HTTP port used by Struts URLs设置http端口struts.url.https.portThe HTTPS port used by Struts URLs设置https端口struts.url.includeParamsThe default includeParams method to generate Struts URLs在url中产生 默认的includeParamsstruts.velocity.configfileThe Velocity configuration file pathvelocity配置文件路径struts.velocity.contextsList of Velocity context namesvelocity的context列表struts.velocity.manager.classnameorg.apache.struts2.views.velocity.VelocityManager implementation classorg.apache.struts2.views.velocity.VelocityManager接口名struts.velocity.toolboxlocationThe location of the Velocity toolboxvelocity工具盒的位置struts.xslt.nocacheWhether or not XSLT templates should not be cached是否XSLT模版应该被缓存

❸ struts2-配置文件struts.properties

struts.properties文件必须放倒web应用下的类加载路径下才能使用,WEB-INF/classes路径下。通常直接将其放到src路径下就可以了,struts.properties是一个key-value文件。

❹ struts2配置文件struts.xml param

妹子,哥虽然不清楚里面写的什么,但我也尝试着给你翻译一下吧!哈哈!<action name="ExportArticle" class="action.ExportArticle"> <result name="success" type="stream"> 如果返回成功sucess <param name="contentType">application/zip</param> <param name="inputName">inputStream</param> <param name="contentDisposition">inline;filename="exportedfiles.zip"</param></action>这个明显就是调用一个名为: ExportArticle方法的入口参数初始化配置信息先翻译下编程英语吧:action:方法,又叫函数,是一个类里面实现数据操作的过程result: 返回值 type:返回类型是数据流对象param: 函数的入口参数 name :入口参数变量名称<param>入口参数初始化值</param>ExportArticle:导出文章内容contentType:内容类型inputName:输入名称contentDisposition:内容定位inline:是CSS里的 "在同一行" application/zip:应用程序或者压缩文件如果哥没猜错,在类库里函数定义原型:stream ExportArticle(contentType , inputName , contentDisposition )其中,调用这个函数的入口参数设置是:ExportArticle("application/zip" , inputStream , "inline;filename=\"exportedfiles.zip\" " )

❺ 请帮我详细解释Struts2的配置文件

<constant name="struts.configuration.xml.reload" value="true"></constant>//是说,当你的配置文件改变是,struts自动读取,不需要你重启服务。<constant name="struts.objectFactory" value="spring"></constant>//与spring框架结合使用,你的action对象由spring帮助生成了。<package name="" extends="struts-default" namespace="/">//这个struts的包名,继承struts-default,就是这个写,你也不需要多想,name写什么都行//UsersAction这个类实现了action接口,给这个action起来个名字叫usersAction_*,*的意思是说,usersAction_后面可以跟要执行的方法名,这与method="{1}"相呼应,*的名字,就是{1}的方法名 <action name="usersAction_*" class="UsersAction" method="{1}"> <result name="success">/result.jsp</result>//return “SUCCESS”时的转向路径,注意我的大小写 <result name="input">/login.jsp</result>>//return “INPUT”时的转向路径,注意我的大小写 <result name="list">/list.jsp</result>>//return “list”时的转向路径,注意我的大小写 </action></package>

❻ 以下关于struts2的配置内容应该在哪个配置文件中编写

strtus2的配置文件有好几种,核心是struts.xml,常量文件struts.properties

❼ struts2 web.xml 配置文件

Struts1的入口点是一个Servlet,而Struts2的入口点是一个过滤器(Filter)。因此,Struts2要按过滤器的方式配置。这就是struts2 web.xml,如果没有写上面的语言的话就不会对于提交的action进行捕捉与匹配,当然你的Struts的功能就不能实现了。

❽ 关于struts2配置文件

你可以只用一个* ,就是动态传参,是什么*action就执行*这个方法比如 <action name="*action" class="com.zuxia.snders.ent.action.FactorySiteAction" method="{1}"> <result name="delete">/FactorySite/show.jsp</result> <result name="add">/FactorySite/add.jsp</result> <result name="view">/FactorySite/view.jsp</result> <result name="update">/FactorySite/update.jsp</result> <result name="show">/FactorySite/show.jsp</result> </action>

❾ 在struts2应用中,请问能否修改配置文件名称 比如:默认的配置文件名为struts.xml,改为mystruts.xml

据我所知,默认抄的struts.xml是有规定的,struts运行时先找struts,xml读取里面的配置,这是除了web.xml之外,最基本的配置文件了,你要是把这个改名了,程序怎么找呢?所以不要动它,不要修改它,如果你想采用分散的配置方法,可以使用include的方式。学这种框架,建议先学整体,不要抠细节,否则容易学的很痛苦,因为框架就是方便你用的,约定重于配置。

❿ Struts2中Struts.xml的作用是什么

struts.xml 为Struts 2的核心配置文件。struts.xml文件主要负责管理应用中的Action映射,以及该Action包含的Result定义等。struts.xml中主要配置Struts项目的一些全局的属性,用户请求和响应Action之间的对应关系,以及配置Action中可能用到的参数,以及处理结果的返回页面。还包括各种拦截器的配置等。


赞 (0)