1、struts2访问后缀配置。
第一步先在web.xml配置
<filter> <filter-name>struts</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class> </filter> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>*.action</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>*.htm</url-pattern> </filter-mapping> <filter-mapping> <filter-name>struts</filter-name> <url-pattern>*.do</url-pattern> </filter-mapping>第二步在struts.xml文件配置
<constant name="struts.action.extension" value="action,htm,do"></constant>
2、struts配置freemarker
freemarker需要jar包 freemarker-2.3.16.jar
1) 在让action的result的type为freemarker
<action name="test1" class="com.zf.action.Action1" method="test1"> <result name="input" type="freemarker">/test2.ftl</result> </action>