struts2学习笔记(3)struts.xml的一些常用设置
2024-08-24 03:52:29
在开发中通常需要用到多个配置文件,可以通过在web.xml中添加以下代码:
<include file="login.xml"></include>
将src中的login.xml集成到web.xml中
xml的编码问题:若xml中出现编码问题,则加上以下代码:
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
默认action的设置:
在struts.xml中添加以下代码:
<default-action-ref name="error"></default-action-ref>
<action name="error">
<result >/error.jsp</result>
</action>
再在webroot里添加error.jsp,则在输入网址无效的情况下会自动执行error.action
伪造网页后缀:
在struts.xml中添加以下代码:
<constant name="struts.action.extension" value="html"></constant>
则http://localhost:8080/test/helloworld.action可改写为http://localhost:8080/test/helloworld.html
此时依然可以访问
最新文章
- .NET 平台下的插件化开发内核(Rabbit Kernel)
- matlab和C/C++混合编程--调用opencv
- 重拾Ajax
- iOS多线程初见
- JSON解析保存在类中
- Windows API获取系统配置文件的配置参数
- linode更换Linux内核教程(独家)
- use include to read a file
- 在CentOS 7.3 中安装 NVIDIA GT730 显卡驱动
- Windows -- 从注册表删除IE浏览器加载项
- 写在最前面 - 《看懂每一行代码 - kubernetes》
- CodeForces - 455C Civilization (dfs+并查集)
- mark_save
- 1-Lombok工具使用
- jquery ajax error函数和及其参数详细说明(转载)
- HBase(九)HBase表以及Rowkey的设计
- 正则表达式入门(c#)
- CSS浏览器兼容问题集-第四部分
- 超级干货,python常用函数大总结
- DFT到FFT的理解