手记

Struts2指定多个配置文件

来自慕课的struts2入门
1、如果有很多个Action的配置文件,则需要在struts.xml中使用

<include file="fileName.xml"/>

来包含其他的配置文件
2、struts文件中添加 <constant name="struts.i18n.encoding" value="UTF-8"></constant>
以防乱码问题的出现
配置文件和struts.xml的格式如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" "http://struts.apache.org/dtds/struts-2.3.dtd">
<struts>
...
</struts>
3人推荐
随时随地看视频
慕课网APP