SSH Strut2向前端返回纯文本
Action代码
@SuppressWarnings("deprecation")
private InputStream msg;
public String xgjb(){
//向页面返回success
msg= new StringBufferInputStream("success");
return SUCCESS;
}
//记得写msg的get方法
public InputStream getMsg() {
return msg;
}
Strut2代码
<!-- 返回类型为text/html-->
<action name="xgjb" class="com.xt.web.ProtectAction">
<result name="success" type="stream">
<param name="contentType">text/html</param>
<param name="inputName">msg</param>
</result>
</action>
页面请求结果