struts2显示图片
来源:互联网 发布:twisted 网络框架 编辑:程序博客网 时间:2024/06/08 19:11
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.ActionContext;
public class TestDao {
private ByteArrayOutputStream bout = new ByteArrayOutputStream(4096);
public String execute(){
HttpServletResponse response=(HttpServletResponse)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE);
try {
BarCoderTool barTool=new BarCoderTool();
bout=barTool.doGet((HttpServletRequest)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST),(HttpServletResponse)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE));
}catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
response.setContentType("image/jpeg");
try {
response.getOutputStream().write(bout.toByteArray());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.opensymphony.xwork2.ActionContext;
public class TestDao {
private ByteArrayOutputStream bout = new ByteArrayOutputStream(4096);
public String execute(){
HttpServletResponse response=(HttpServletResponse)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE);
try {
BarCoderTool barTool=new BarCoderTool();
bout=barTool.doGet((HttpServletRequest)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_REQUEST),(HttpServletResponse)ActionContext.getContext().get(org.apache.struts2.StrutsStatics.HTTP_RESPONSE));
}catch (Exception e) {
// TODO Auto-generated catch block
//e.printStackTrace();
}
response.setContentType("image/jpeg");
try {
response.getOutputStream().write(bout.toByteArray());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}
- struts2显示图片
- struts2图片显示
- struts2 页面显示 图片
- struts2图片显示
- Struts2显示图片验证码
- struts2上传图片和显示图片
- struts2上传图片后并显示图片
- Struts2中显示图片验证码
- struts2页面上显示图片流
- struts2的Struts2中显示图片验证码
- struts2保存图片到数据库,从数据库显示图片
- struts2+hibernate+sqlserver2005图片上传以及在页面显示
- Struts2+Spring+JDBC 实现图片上传与显示
- Struts2整合jasperreport html展示图片不显示的解决办法
- struts2上传图片,并显示在 jsp 上
- struts2 图片上传到服务器并显示在页面
- 使用struts2生成图片验证码并显示
- Struts2文件(图片)上传及页面显示
- java连接sqlserver2000
- 如何读取android asserts下面已经存在的sqlite数据库
- 专访王豫翔:编程道路上的“三少三多”
- Java 连接sqlserver2000 获得字段数据时应该注意顺序
- 针对PHP的网站主要存在下面几种攻击方式:
- struts2显示图片
- PHP获取用户真实 IP , 淘宝IP接口获得ip地理位置
- Ext中一次给一个组件注册多个事件
- PHP攻击网站防御代码-以及攻击代码反译
- js打印
- PHP 计算页面执行时间
- spring 数据源配置部分文件
- http://blog.jobbole.com/33686/
- spring的注入集合类型的元素小结