解决方案 »
- post请求带字段和表头到某个网站
- 数据库字符集是us7ascii,websphere的jvm是gbk,页面的编码是gbk
- Java Socket实现和服务器的长连接
- getHibernateTemplate()为什么需要flush()?
- hibernate单向关联和双向关联
- 高分求助!EJB编译问题!古怪!在线急等!!
- 这句话对吗?能够构造一个接口的对象??
- 关于tomcat启动困扰很久的问题,希望在这得到解决!!!
- 汉字转换问题!
- EJB是什么?谁能解答一下?
- 各位自己都是如何解决tomcat5+struts+mysql的中文问题的
- Intellij idea 提示SessionFactory 没有类型匹配,不能注入
改为<img height="150" width="120" src="XXXX.action?id=${usedgood.picture}"/><br/>
在XXXX.action中这样写: if (id!= null) {
byte[] content = id;
if (content != null) {
response.setContentType("image/bmp");
// response.setContentType("image/jpeg");
out.write(content);
}
}
return null;思路大体是这样的,前提是你的图片是二进制的
这里的src使用你图片存放的路径位置就可以了。
<img height="150" width="120" src="getImage.action?usedgood.picture=<s:property value="#usedgood.picture"/>"/>
String goodsname=usedgood.getGoodsname();
List list=searchService.getSearch(goodsname);
System.out.print(list.size());
Map request=(Map)ActionContext.getContext().get("request");
request.put("list",list);
return SUCCESS;
}
上面代码的goodsname是在jsp页面输入的,现在通过searchService.getSearch(goodsname)查出list了,我想问一下怎样才能在本action.java这里得到list里面的一个goodsname字段数据。
byte[] blob = new byte[1024];
int byteread = 0;
FileInputStream in = new FileInputStream(fullfilename); response.reset();
response.setContentType("image/jpg");
OutputStream toClient = response.getOutputStream(); // 读入多个字节到字节数组中,byteread为一次读入的字节数
while ((byteread = in.read(blob)) != -1) {
toClient.write(blob, 0, byteread);
} in.close(); toClient.flush();
toClient.close();
response.flushBuffer();
<%
if(request.getAttribute("firsttime")==null)
{
response.sendRedirect("loadActon.action");
}
%>
但是它提示
message There is no Action mapped for namespace / and action name loadActon.
description The requested resource (There is no Action mapped for namespace / and action name loadActon.) is not available.
用了这个方法是不是一定要用到namespace?
<%
if(request.getAttribute("firsttime")==null)
{
response.sendRedirect("loadActon.action");
}
%>