Struts2 返回一个为字符串的response
2013-10-30 22:41
197 查看
package actions; import java.io.InputStream; import java.io.StringBufferInputStream; import com.opensymphony.xwork2.ActionSupport; public class TextResultAction extends ActionSupport { private InputStream inputStream; public InputStream getInputStream() { return inputStream; } public void setInputStream(InputStream inputStream) { this.inputStream = inputStream; } public String execute() throws Exception { inputStream = new StringBufferInputStream( "Hello World! This is a text string response from a Struts 2 Action."); return SUCCESS; } } <action name="text-result" class="actions.TextResultAction"> <result type="stream"> <param name="contentType">text/html</param> <param name="inputName">inputStream</param> </result> </action>
转自:http://blog.sina.com.cn/s/blog_530bf5d20100c15o.html
相关文章推荐
- Struts2 返回一个为字符串的response
- 在struts2 中 JSONArray.fromObject转化字符串的一个特殊用法,直接返回值
- struts2:JSON在struts中的应用(JSP页面中将对象转换为JSON字符串提交、JSP页面中获取后台Response返回的JSON对象)
- struts2怎么返回一个字符串给jsp?(使用json)
- 关于struts2 返回的结果是一个 简单的字符串的解决
- 关于struts2 返回的结果是一个 简单的字符串的解决
- 重写使struts2返回一个字符串,而不是一个页面
- 如何返回一个为字符串的response
- struts2 返回一个字符串
- Struts2如何返回一个JSON类型的字符串
- 【微软100题】写一个函数,它的原形是int continumax(char *outputstr,char *intputstr) 功能: 在字符串中找出连续最长的数字串,并把这个串的长度返回
- location的search操作——解析url字符串,返回包含所有参数的一个对象
- 解决Spring MVC @ResponseBody返回中文字符串乱码问题
- 如何在一个窗体关闭的时候,返回一个字符串
- python请编写一个函数,它接受一个 list,然后把list中的所有字符串变成大写后返回
- PHP 为你提供一个叫__toString() 的函数,你可以用它来返回表示对象的字符串信息,而且一旦定义它,打印命令将调用它并打印出返回的字符串。
- 根据一个包含汉字的字符串返回一个汉字拼音首字母的字符串
- 输出一个字符串遇见‘ \0 ’停止并返回字符串字符的个数
- 为下面的函数原型编写函数定义: int ascii_to_integer(char *str); 这个字符串参数必须包含一个或者多个数字,函数应该把这些数字字符转换为整数并返回这个整数。如果字符串参数
- 从一个字符串中删除一个子串后返回该字符串和包含的子串的个数