怎么在jsp文件里嵌入Servlet生成的图像? 在jsp用一个<img>标签行不行? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 这个easy!------------------------------------------------------------------------------------------java:GetDocImg.java:import javax.servlet.*;import javax.servlet.http.*;import java.streammanager.*;import org.apache.axis.client.Call;import org.apache.axis.client.Service;import javax.xml.rpc.ParameterMode;import java.util.*;import java.net.*;import java.util.*;import org.xml.sax.*;import java.io.*;public class GetDocImg extends HttpServlet { private static final String CONTENT_TYPE = "image/jpeg"; StreamLibrary oStream = new StreamLibrary(); /**Initialize global variables*/ public void init() throws ServletException { } /**Process the HTTP Get request*/ public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String kkk = ""; byte b[] = new byte[1024]; try{ goldshield_fzcweb.JClientDataSet jcd = new goldshield_fzcweb.JClientDataSet(); String docid = request.getParameter("docid"); kkk = (String)jcd.getValue("getSltBTImage", new Object[]{new Integer(docid)}); b = oStream.getPictureBytes(kkk); }catch(Exception ex) { } response.setContentType(CONTENT_TYPE); javax.servlet.ServletOutputStream out = response.getOutputStream(); out.write(b); } /**Clean up resources*/ public void destroy() { } public GetDocImg() { try { jbInit(); } catch(Exception e) { //e.printStackTrace(); } } private void jbInit() throws Exception { }}------------------------------------------------------------------------------------------jsp:<tr> <img src="servlet/GetDocImg?docid=<%=vDOCID.elementAt(i)%>"></tr>------------------------------------------------------------------------------------------ 页面中如何定义不定数组? appfuse创建struts2项目的问题 Spring入门简单的一个小例子,不明白??来者有分 新手遇见的问题~!~高手快来帮忙吧 谢谢了 xsl中utf-8编码中使用form提交数据编码问题 如何从JSP文件向Javascript函数传递数组对象? 请教动态树型菜单问题,在线等---- 有关求值的问题? JDBC-NET纯JAVA. Spring疑问 问两个基础的问题以后再加分了,谢谢各位老大 /DisplayCourse.jsp(56,0) Unterminated <jsp:useBean>各位好心人,帮我解决下这个问题吧!
------------------------------------------------------------------------------------------
java:
GetDocImg.java:
import javax.servlet.*;
import javax.servlet.http.*;
import java.streammanager.*;import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import javax.xml.rpc.ParameterMode;
import java.util.*;
import java.net.*;
import java.util.*;
import org.xml.sax.*;
import java.io.*;public class GetDocImg extends HttpServlet {
private static final String CONTENT_TYPE = "image/jpeg"; StreamLibrary oStream = new StreamLibrary();
/**Initialize global variables*/
public void init() throws ServletException {
}
/**Process the HTTP Get request*/
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String kkk = "";
byte b[] = new byte[1024];
try{
goldshield_fzcweb.JClientDataSet jcd = new goldshield_fzcweb.JClientDataSet();
String docid = request.getParameter("docid");
kkk = (String)jcd.getValue("getSltBTImage", new Object[]{new Integer(docid)});
b = oStream.getPictureBytes(kkk);
}catch(Exception ex) {
}
response.setContentType(CONTENT_TYPE);
javax.servlet.ServletOutputStream out = response.getOutputStream();
out.write(b);
}
/**Clean up resources*/
public void destroy() {
} public GetDocImg() {
try {
jbInit();
}
catch(Exception e) {
//e.printStackTrace();
}
}
private void jbInit() throws Exception {
}
}
------------------------------------------------------------------------------------------
jsp:
<tr>
<img src="servlet/GetDocImg?docid=<%=vDOCID.elementAt(i)%>">
</tr>
------------------------------------------------------------------------------------------