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

JspʵÏÖÎļþÏÂÔع¦Äܵķ½·¨

 
£±.×îÖ±½Ó×î¼òµ¥µÄ£¬·½Ê½ÊÇ°ÑÎļþµØÖ·Ö±½Ó·Åµ½htmlÒ³ÃæµÄÒ»¸öÁ´½ÓÖС£ÕâÑù×öµÄȱµãÊÇ°ÑÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶±©Â¶ÁË£¬²¢ÇÒ»¹ÎÞ·¨¶ÔÎļþÏÂÔؽøÐÐÆäËüµÄ¿ØÖÆ£¨ÈçȨÏÞ£©¡£Õâ¸ö¾Í²»Ð´Ê¾ÀýÁË¡£
 
£².ÔÚ·þÎñÆ÷¶Ë°ÑÎļþת»»³ÉÊä³öÁ÷£¬Ð´Èëµ½response£¬ÒÔresponse°ÑÎļþ´øµ½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´ÌáʾÓû§ÊÇ·ñÔ¸Òâ±£´æÎļþµ½±¾µØ¡££¨Ê¾ÀýÈçÏ£©
 
 
<%
response.setContentType(fileminitype);
response.setHeader("Location",filename);
response.setHeader("Cache-Control", "max-age=" + cacheTime);
//filenameÓ¦¸ÃÊDZàÂëºóµÄ(utf-8)
response.setHeader("Content-Disposition", "attachment; filename=" + filename);

response.setContentLength(filelength);
OutputStream outputStream = response.getOutputStream();
InputStream inputStream = new FileInputStream(filepath);
byte[] buffer = new byte[1024];
int i = -1;
while ((i = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, i);
}
outputStream.flush();
outputStream.close();
inputStream.close();
outputStream = null;
%>
 
£³.¼ÈÈ»ÊÇJSPµÄ»°£¬»¹ÓÐÒ»ÖÖ·½Ê½¾ÍÊÇÓÃAppletÀ´ÊµÏÖÎļþµÄÏÂÔØ¡£²»¹ý¿Í»§Ê×ÏȵÃÐÅÈÎÄãµÄÕâ¸öAppletС³ÌÐò£¬ÓÉÕâ¸ö³ÌÐòÀ´½ÓÊÜÓÉservlet·¢ËÍÀ´µÄÊý¾ÝÁ÷£¬²¢Ð´Èëµ½±¾µØ¡£
servlet¶ËʾÀý
 
 
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
res.setContentType(" text/plain ");
OutputStream outputStream = null;
try {
outputStream = res.getOutputStream();
//°ÑÎļþ·¾¶ÎªsrcFileµÄÎļþдÈëoutputStreamÖÐ
popFile(srcFile, outputStream)) ;

} catch (IOException e) {
e.printStackTrace();
}
}
 
JApplet¶ËʾÀý
 
 
URLConnection con;
try {
//urlÊDZ»µ÷ÓõÄSERVLETµÄÍøÖ· Èç *.do
con = url.openConnection();
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProper


Ïà¹ØÎĵµ£º

JSPÎÊ´ð¼¯

1¡¢ÈçºÎ»ìºÏʹÓÃJspºÍSSI #include?
ÔÚJSPÖпÉÒÔʹÓÃÈçÏ·½Ê½°üº¬´¿HTML£º
µ«ÊÇÈç¹ûdata.incÖаüº¬JSP CODE £¬ÎÒÃÇ¿ÉÒÔʹÓãº
2¡¢ÈçºÎÖ´ÐÐÒ»¸öḬ̈߳²È«µÄJSP?
Ö»ÐèÔö¼ÓÈçÏÂÖ¸Áî
3¡¢JSPÈçºÎ´¦ÀíHTML FORMÖеÄÊý¾Ý?
ͨ¹ýÄÚÖõÄrequest¶ÔÏó¼´¿É£¬ÈçÏ£º
String item = request.getParameter("item");
int howM ......

JSPÖеIJÎÊý´«µÝ·½·¨

£¨1£©ÀûÓÃ<jsp:param name="paramName" value="paramValue"></jsp:param>ÆäÖÐnameΪÓëÊôÐÔÏà¹ØÁªµÄ¹Ø¼ü´Ê£¬valueΪÊôÐÔµÄÖµ¡£
    ʾÀý£º´«³£Á¿×Ö·û´®<param name="userName" value="shilei"/>
    ʾÀý£º´«±äÁ¿ User user=new User("shilei");//UserÊÇÒ»¸öÀà
 &n ......

jspµ÷Óô洢¹ý³Ì

  ÔÚsql2000Öд´½¨´æ´¢¹ý³Ì£º
--ÇóÁ½ÊýÖ®ºÍ
create proc up_sum @a int ,@b int ,@result int output
as
select @result= @a+@b
µ÷Ó÷½·¨£º
...
CallableStatement cstmt=con.prepareCall("exec  up_sum ?,?,?");
cstmt.registerOutParameter(3,java.sql.Types.INTEGER);
    &nb ......

jsp Ö®Filter

(1) ÇëÇóÐÅÏ¢±àÂëת»¯µÄFilter
importjava.io.IOException;
importjava.util.Enumeration;
importjavax.servlet.Filter;
importjavax.servlet.FilterChain;
importjavax.servlet.FilterConfig;
importjavax.servlet.ServletException;
importjavax.servlet.ServletRequest;
importjavax.servlet.ServletResponse;
......

̸JSPÓëXMLµÄ½»»¥

̸JSPÓëXMLµÄ½»»¥
ʹÓÃJavaServer PagesÓÐÈýÖÖ²»Í¬µÄ·½·¨ÓÃÓÚ´¦ÀíXMLÎĵµ£¬Ã¿ÖÖ·½·¨¶¼ÓÐÀûÓÚÌá¸ß·ÖÀëÒ³Ãæ´úÂëÓëXMLÊý¾ÝµÄˮƽ£¬ÓÐÀûÓÚ¼ò»¯¿ª·¢ÍøÒ³µÄ¸´ÔӶȲ¢ÇÒ¸ÄÉÆÌá¸ß×é¼þÓëÒ³Ãæ´úÂëµÄ¿ÉÖØÓÃÐÔ¡£
¡¡¡¡JavaServer Pages ( JSP)ºÍXMLÊÇSunµÄJ2EEµÄÁ½¸öÖÁ¹Ø½ôÒªµÄ×é¼þ¡£ JSPÊÇÓÃÓÚ´´½¨Ó¦ÓóÌÐò·þÎñÆ÷¶Ë³ÌÐòµÄÓÐЧ¹¤¾ß£¬¶ø¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ