标签:support pack 错误 pac utf-8 开发 over hello 撰写
//Demo1Action.java
package com.struts.a_result;
import com.opensymphony.xwork2.ActionSupport;
public class Demo1Action extends ActionSupport {
@Override
public String execute() throws Exception {
return "SUCCESS";
}
}
//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>
<!-- 可配置的常量 -->
<!-- i18n:国际化 解决post的提交乱码和输出中文乱码 -->
<constant name="struts.i18n.encoding" value="UTF-8"></constant>
<!-- 指定反问action时的后缀名
http://localhost:8080/Struts2_test1/hello/HelloAction.xhtml
-->
<constant name="struts.action.extension" value="action"></constant>
<!-- 指定struts2是否以开发模式运行
1.热加载主配置.(不需要重启即可生效)
2.提供更多错误信息输出,方便开发时的调试
-->
<constant name="struts.devMode" value="true"></constant>
<package name="SSDA1" namespace="/" extends="struts-default" >
<action name="Demo1Action" class="com.struts.a_result.Demo1Action" method="execute" >
<result name="SUCCESS" type="dispatcher" >/hello.jsp</result><!-- type="dispatcher" 默认为转发 -->
</action>
<!-- 重定向 -->
<action name="Demo2Action" class="com.struts.a_result.Demo2Action" method="execute" >
<result name="SUCCESS" type="redirect" >/hello.jsp</result><!-- type="dispatcher" 默认为转发 -->
</action>
<!-- 重定向到Action -->
<action name="Demo3Action" class="com.struts.a_result.Demo3Action" method="execute" >
<result name="SUCCESS" type="redirectAction">
<!-- action的名字 -->
<param name="actionName">Demo1Action</param>
<!-- action所在的命名空间 -->
<param name="namespace">/</param>
</result>
</action>
</package>
<!-- <include file=""></include>com/struts2/b_dynamic/struts.xml -->
</struts>
标签:support pack 错误 pac utf-8 开发 over hello 撰写
原文地址:https://www.cnblogs.com/Terlong/p/9231001.html