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

jspÎļþµÄÉÏ´«ºÍÏÂÔزÙ×÷´úÂë

jspÎļþÉÏ´«ºÍÏÂÔØ
package net.jspcn.tool;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
*
* Title: ÎļþÉÏ´«Àà
* Description: ¼ÈÄܶÔÎļþ½øÐÐÉÏ´«,ÓÖÄÜÈ¡µÃÊäÈë¿òµÄÖµ,×î¶à¿ÉͬʱÉÏ´«255¸öÎļþ
* Copyright: Copyright (c) 2002
* Company: Tekson
* @author ĪÇí
* @version 1.0
*/
public class UploadBean {
private String[] sourceFile = new String[255]; //Ô´ÎļþÃû
private String[] suffix = new String[255]; //Îļþºó׺Ãû
private String canSuffix = ".gif.jpg.jpeg.png"; //¿ÉÉÏ´«µÄÎļþºó׺Ãû
private String objectPath = "c:/"; //Ä¿±êÎļþĿ¼
private String[] objectFileName = new String[255]; //Ä¿±êÎļþÃû
private ServletInputStream sis = null; //ÊäÈëÁ÷
private String[] description = new String[255]; //ÃèÊö״̬
private long size = 100 * 1024; //ÏÞÖÆ´óС
private int count = 0; //ÒÑ´«ÊäÎļþÊýÄ¿
private byte[] b = new byte[4096]; //×Ö½ÚÁ÷´æ·ÅÊý×é
private boolean successful = true;
private Hashtable fields = new Hashtable();
public UploadBean() {
}
//ÉèÖÃÉÏ´«ÎļþµÄºó׺Ãû
public void setSuffix(String canSuffix) {
this.canSuffix = canSuffix;
}
//ÉèÖÃÎļþ±£´æ·¾¶
public void setObjectPath(String objectPath) {
this.objectPath = objectPath;
}
//ÉèÖÃÎļþ±£´æ·¾¶
public void setSize(long maxSize) {
this.size = maxSize;
}
//ÎļþÉÏ´«´¦Àí³ÌÐò
public void setSourceFile(HttpServletRequest request) throws IOException {
sis = request.getInputStream();
int a = 0;
int k = 0;
String s = "";
while ( (a = sis.readLine(b, 0, b.length)) != -1) {
s = new String(b, 0, a);
if ( (k = s.indexOf("filename=\"")) != -1) {
// È¡µÃÎļþÊý¾Ý
s = s.substring(k + 10);
k = s.indexOf("\"");
s = s.substring(0, k);
sourceFile[count] = s;
k = s.lastIndexOf(".");
suffix[count] = s.substring(k + 1);
if (canTransfer(count)) {
transferFile(count);
}
++count;
} else if ( (k = s.indexOf("name=\"")) != -1) {
// ÆÕͨ±íµ¥ÊäÈëÔªËØ£¬»ñÈ¡ÊäÈëÔªËØÃû×Ö
String fieldName = s.substring(k+6, s.length()-3);
sis.readLine(b, 0, b.length);


Ïà¹ØÎĵµ£º

JSP·ÖÒ³¼¼Êõ

ÔÚʹÓÃÊý¾Ý¿âµÄ¹ý³ÌÖУ¬²»¿É±ÜÃâµÄÐèҪʹÓõ½·ÖÒ³µÄ¹¦ÄÜ£¬¿ÉÊÇJDBCµÄ¹æ·¶¶Ô´ËȴûÓкܺõĽâ¾ö¡£¶ÔÓÚÕâ¸öÐèÇóºÜ¶àÅóÓѶ¼ÓÐ×Ô¼ºµÄ½â¾ö·½°¸£¬±ÈÈçʹÓÃVectorµÈ¼¯ºÏÀàÏȱ£´æÈ¡³öµÄÊý¾ÝÔÙ·ÖÒ³¡£µ«ÕâÖÖ·½·¨µÄ¿ÉÓÃÐԺܲÓëJDBC±¾ÉíµÄ½Ó¿ÚÍêÈ«²»Í¬£¬¶Ô²»Í¬ÀàÐ͵Ä×ֶεÄÖ§³ÖÒ²²»ºÃ¡£ÕâÀïÌṩÁËÒ»ÖÖÓëJDBC¼æÈÝÐԷdz£ºÃµÄ·½°¸¡£
JD ......

JSP Standard Tag Libraries ʵ¼ùÀí½â

 ÔÚ±¾ÆªÎÄÕÂÖÐ,ÎÒÃǽ«»áÉîÈëÁ˽âÔÚ²»Í¬µÄTag LibraryÃèÊö·û(Tag Library Descriptors:TLDs)ÖÐʹÓø÷ÖÖ²»Í¬µÄtagµÄÇé¿ö.ÎÒÃǽ«»áÒÀ´ÎÑо¿ Ìõ¼þ¡¢Ñ­»·¡¢URL¡¢U18N¡¢XMLµÈtagµÄÓ÷¨¡£ÒÔ´ËÀ´Ìá¸ßÄã¶ÔJSTLµÄÈÏʶºÍÓ¦ÓÃÄÜÁ¦,ÔÚÔĶÁ±¾ÎÄÇ°£¬ÄãÓ¦¸Ã¶Ô JSP Tag LibÓÐËùÁ˽⣬²¢ÇåÎúÓйØJSTL£¨JSP Standard Tag Libraries£©µÄ»ù± ......

JSPÖеÄEL±í´ïʽÏêϸ½éÉÜ

來Ô´£ºhttp://www.diybl.com/course/4_webprogram/jsp/jsp_js/2008229/102031.html
Ò»¡¢JSP ELÓïÑÔ¶¨Òå
        E L£¨Expression Language£©  Ä¿µÄ£ºÎªÁËʹJSPдÆðÀ´¸ü¼Ó¼òµ¥¡£
      
±í´ïʽÓïÑÔµÄÁé¸ÐÀ´×ÔÓÚ ECMAScript ºÍ XPath ......

JSP+MySqlµÄʱ¼ä´¦Àí

ºÜ¾ÃûÓÐÓÃMysqlÁË£¬·¢ÏÖССµÄʱ¼äÎÊÌâÒ²Óöµ½²»ÉÙÂé·³£¬ºÇºÇ
ËùÒÔ×ܽáһϣº
µÚÒ»ÖÖ:
Date time= new java.sql.Date(new java.util.Date().getTime());
µÚ¶þÖÖ:
java ÓÃPreparedStatementÀ´setDate,ÓÃÎʺŵÄÐÎʽ¸øÈÕÆÚÎʺŸ³Öµ
pstmt.setTimestamp(8, new Timestamp(System.currentTimeMillis()));  
pst ......

JSPµÄÄÚÖöÔÏó¼°·½·¨

request request±íʾHttpServletRequest¶ÔÏó¡£Ëü°üº¬ÁËÓйØä¯ÀÀÆ÷ÇëÇóµÄÐÅÏ¢£¬²¢ÇÒÌṩÁ˼¸¸öÓÃÓÚ»ñÈ¡cookie, header, ºÍsessionÊý¾ÝµÄÓÐÓõķ½·¨¡£
response response±íʾHttpServletResponse¶ÔÏ󣬲¢ÌṩÁ˼¸¸öÓÃÓÚÉèÖÃËÍ»Ø ä¯ÀÀÆ÷µÄÏìÓ¦µÄ·½·¨£¨Èçcookies,Í·ÐÅÏ¢µÈ£©
out out ¶ÔÏóÊÇjavax.jsp.JspWriterµÄÒ»¸öʵÀý£¬ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ