1.作用:将response中的数据直接打印到当前页面指定的地方
2.配置:
<action name="test" class="testAction"method="test">
<result name="success" type="plainText">
<param name="charSet">UTF-8</param>
<param name="location">/test.jsp</param>
</result>
</action>
3.action中必须用response给客户端发送数据
ServletActionContext.getResponse().setContentType ("text/html;charset=utf-8");
PrintWriter out = ServletActionContext.getResponse().getWriter();
out.print("test");
out.flush();
out.close();
4.必须配置<param name="charSet">UTF-8</param>否则会出现乱码
5.必须配置<param name="location">/test.jsp</param>有可能会在服务器端报 java.lang.IllegalStateException错。

相关文章:

  • 2021-11-11
  • 2021-07-05
  • 2021-07-24
  • 2021-08-25
  • 2022-02-23
  • 2022-12-23
  • 2021-09-24
  • 2021-09-04
猜你喜欢
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
相关资源
相似解决方案