请问大家一个问题,我在JSP页面用ServletOutputStream已经输出了一个图片了,请问,我还想输出JAVASRCIPT,代码怎么写?<%
FileInputStream in = new FileInputStream("d://house_1.jpg");
int len = 0;
byte[] b = new byte[1024];
ServletOutputStream sout = response.getOutputStream();
try {
while ((len = in.read(b)) > 0) { //图片输出的输出流 sout.write(b, 0, len); }
sout.flush();
//输入完毕,清除缓冲
response.setContentType("text/html");
//sout.println("<script language="+"javascript"+">window.open ('http://192.168.1.9:9001', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')"+"</script>");
sout.flush();
out.clear();
out = pageContext.pushBody();
//response.sendRedirect("http://192.168.1.9:9001/");
sout.close();
in.close();
} catch (Exception e) {
in.close();
sout.close(); e.printStackTrace();
}
%>
FileInputStream in = new FileInputStream("d://house_1.jpg");
int len = 0;
byte[] b = new byte[1024];
ServletOutputStream sout = response.getOutputStream();
try {
while ((len = in.read(b)) > 0) { //图片输出的输出流 sout.write(b, 0, len); }
sout.flush();
//输入完毕,清除缓冲
response.setContentType("text/html");
//sout.println("<script language="+"javascript"+">window.open ('http://192.168.1.9:9001', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')"+"</script>");
sout.flush();
out.clear();
out = pageContext.pushBody();
//response.sendRedirect("http://192.168.1.9:9001/");
sout.close();
in.close();
} catch (Exception e) {
in.close();
sout.close(); e.printStackTrace();
}
%>
<%
FileInputStream in = new FileInputStream("d://house_1.jpg");
int len = 0;
byte[] b = new byte[1024];
ServletOutputStream sout = response.getOutputStream();
try {
while ((len = in.read(b)) > 0) {//图片输出的输出流sout.write(b, 0, len);}
sout.flush();
//输入完毕,清除缓冲
response.setContentType("text/html");
%>
<script language="javascript">
//此处放你的js代码
</script>
FileInputStream in = new FileInputStream("d://house_1.jpg");
int len = 0;
byte[] b = new byte[1024];
ServletOutputStream sout = response.getOutputStream();
try {
while ((len = in.read(b)) > 0) { //图片输出的输出流 sout.write(b, 0, len); }
} catch (Exception e) {
}
sout.flush();
out.clear();
out = pageContext.pushBody();
//输入完毕,清除缓冲
response.setContentType("text/html");
%>
<script language="javascript">
//此处放你的js代码
window.open ('http://www.163.com', 'newwindow', 'height=100, width=400, top=0,left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no')
</script>
</body>