`
ldzyz007
  • 浏览: 704326 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

struts2的result type="plainText"

阅读更多
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错。
6.不能用sitemesh装饰页面,否则在使用jquery.form.js的ajaxForm方法时,如果表单中有file域,回调函数可能执行不了。估计jquery.form.js与sitemesh有冲突
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics