Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÔÚjspÖÐÈçºÎ×öÏÂÔØ£¿

ÎÒÓÃa±êǩʵÏÖÁËÒ»¸öÏÂÔع¦ÄÜ£¬ÎªÊ²Ã´²»ÄÜÏÂÔØ£¿ÊÇÎҵķ¾¶ÖÐÓÐÖÐÎÄ£¿»¹ÊÇÓþø¶Ô·¾¶µÄÔ­Òò£¿
Çë´ó¼Ò¸æËßÎÒ£¬ÕâÑù×öÓÐʲôҪעÒâµÄµØ·½Ã»ÓУ¿
aʵÏÖÏÂÔع¦ÄÜ£¿

1. <a href="down.jsp">ÏÂÔØÎļþ </a>
2.down.jsp
<%@ page contentType="application/vnd.ms-word;charset=gb2312" %>
<%@ page import="java.io.*" %>
<%
  response.setContentType("application/vnd.ms-word"); 
  out.clearBuffer(); // Èç¹ûʹÓÃJSP,ÐèÒª¼ÓÉÏÕâÒ»¾ä       
  response.addHeader("Content-Disposition", new String(("filename=ÎÒµÄÎĵµ.doc").getBytes("GBK"), "ISO-8859-1"));
  //Õë¶ÔÖÐÎÄÎļþÃû£ºnew String(("attachment;filename=ÎÒµÄÎĵµ.doc").getBytes("GBK"), "ISO-8859-1"));
  OutputStream os = response.getOutputStream(); // Ò³ÃæÊä³öÁ÷£¬jsp/servlet¶¼¿ÉÒÔ
  os.write("hello£¬ÄãºÃ£¡".getBytes("GB2312"));
  os.close();
%> 



ÎÒÏÖÔÚÈÏΪÊÇtomcatÅäÖõÄÎÊÌ⣿ÊDz»ÊÇtomcatµÄÔ­Òò£¿Èç¹ûÒªÏÂÔØ£¬ÊDz»ÊÇÒªÔÚtomcatµÄʲôµØ·½½øÐÐÒ»ÏÂÅäÖã¿

ÒýÓÃ
ÎÒÏÖÔÚÈÏΪÊÇtomcatÅäÖõÄÎÊÌ⣿ÊDz»ÊÇtomcatµÄÔ­Òò£¿Èç¹ûÒªÏÂÔØ£¬ÊDz»ÊÇÒªÔÚtomcatµÄʲôµØ·½½øÐÐÒ»ÏÂÅäÖã¿

òËƲ»ÓÃÅäÖðÉ!

¾¡Á¿²»ÒªÓÃÖÐÎÄ¡£

response.addHeader.....ÎҼǵÃ


Ïà¹ØÎÊ´ð£º

jspÖÐ <c:if test> Ïà¹ØÎÊÌâ

ÔÚ²éѯºó½«²éѯ³öÀ´µÄÖµ¸³¸ø¸÷ÊäÈë¿ò
<c:if test="${not empty dataValue}">
      fm.SAMPLING_DATE.value=" <c:out value='${dataValue.SAMPLING_DATE}'/ ......

jspÒ³Ãæ»ñÈ¡sessionµÄÎÊÌâ - Java / Java EE

ÎÒÔÚjspÒ³Ãæ´æÉÏÒ»¸ösession,±¾Ò³Ã滹¿ÉÒÔÈ¡³öÖµÀ´.
µ«ÊÇһˢÐÂ,»òÕß´ò¿ªÐµÄÒ³Ãæ¾ÍÈ¡²»³öÖµÀ´ÁË.
Ææ¹ÖµÄÊÇ,ÎÒ²âÊÔÁíÒ»¸ö³ÌÐòʱºò
ÔÚjspÒ³Ãæ´æÉÏÒ»¸ösession,±¾Ò³Ãæ¿ÉÒÔÈ¡³öÖµÀ´,ˢлò´ò¿ªÐÂÒ³ÃæÖµÄÜÈ¡³öÀ´ÁË.
......

jsp¶¯Ì¬°üº¬

include.jspÖÐ
<jsp:include page="divide.jsp?value1=2&value2=3 flush="true">

value1 , value2 µÄÖµ¿ÉÒÔ´ÓÉÏÒ»¸ö´«¸øinclude.jspµÄdata.jspÖÐÈ¡Âð£¿

Èç¹û¿ÉÒÔÕâôд° ......

JSP Ñé֤ͼÏÔʾ´íÎó

ÓÃͨ¹ýseverletÅäÖõÄÑé֤ͼÏÔʾ²»³öÀ´£¬¶øÓÃJSP×öµÄͼûÎÊÌ⣬¹À¼ÆÊÇWEB.XMLÅäÖÃÓÐÎÊÌ⣬Çó½Ì¸ßÊÖ£¬
ÊDz»ÊÇseverletÇëÇó±»ÆäËûFilterÀ¹½ØÁË£¿

Éú³ÉÑé֤ͼƬµÄJAVAÀà
Java code
package com.ding ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ