专注于 JetBrains IDEA 全家桶,永久激活,教程
持续更新 PyCharm,IDEA,WebStorm,PhpStorm,DataGrip,RubyMine,CLion,AppCode 永久激活教程

Struts2的常量配置

1、默认常量配置:

(1)配置文件位置:

96_1.png

(2)配置文件:

96_2.png

以键值对的方式存储。

2、配置文件的修改:

(1)在src目录下新建一个file(名字为struts.properties),在里面写入要修改的键值对。

(2)在struts.xml中配置:

96_3.png

(3)在web.xml中进行配置:

96_4.png

3、配置文件详解(这里采用方式二对配置文件进行修改):

(1)struts.i18n.encoding=UTF-8:解决post提交乱码

96_5.png

(2)struts.action.extension=action,,:指定访问action的后缀名,可以为空或“.action”

后缀为空的情况:

96_6.png

后缀为.action的情况:

96_7.png

如果修改为必须以abc结尾:

96_8.png

没有加abc后缀的话:

96_9.png

加上后缀之后能够正常访问:

96_10.png

(3)struts.devMode = false:指定Struts2是否以开发模式运行:

注释:

### 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.

(1)热加载主配置文件(不需要重启服务器修改的配置文件即可生效)

(2)提供更多错误信息输出,方便开发时的调试

文章永久链接:https://tech.souyunku.com/23135

未经允许不得转载:搜云库技术团队 » Struts2的常量配置

JetBrains 全家桶,激活、破解、教程

提供 JetBrains 全家桶激活码、注册码、破解补丁下载及详细激活教程,支持 IntelliJ IDEA、PyCharm、WebStorm 等工具的永久激活。无论是破解教程,还是最新激活码,均可免费获得,帮助开发者解决常见激活问题,确保轻松破解并快速使用 JetBrains 软件。获取免费的破解补丁和激活码,快速解决激活难题,全面覆盖 2024/2025 版本!

联系我们联系我们