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

jspÉÏ´«Îļþµ½Êý¾Ý¿âºÍ´ÓÊý¾Ý¿âÏÂÔØÎļþ

ÓÃÁËcommons-fileupload-1.2.jarºÍcommons-io-1.3.2.jarÕâÁ½¸ö°ü¡£
save.jsp
<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.regex.*"%>
<%@ page import="org.apache.commons.fileupload.*"%>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>±£´æÉÏ´«Îļþ</title>
</head>
<body bgcolor='#FFFFFF' text='#000000' leftmargin='0' topmargin='40' marginwidth='0' marginheight='0'>
<font size='6' color='blue'>ÎļþÁÐ±í£º</font>
<center>
<table cellpadding=0 cellspacing=1 border=1 width='100%'>
<tr>
<td bgcolor=#008080>ÎļþÃû</td>
<td bgcolor=#008080>´óС</td>
</tr>
<%
// Á¬½Ó×Ö
String SQL_CON_DRIVER = "com.mysql.jdbc.Driver";
String SQL_CON_USERNAME = "root";
String SQL_CON_PASSWORD = "ddd";
String SQL_CON_STRING = "jdbc:mysql://localhost/ddd?useUniCode=true&characterEncoding=utf-8";
// Á¬½ÓÇý¶¯
try{
  Class.forName(SQL_CON_DRIVER).newInstance();
}
catch(ClassNotFoundException e){
  out.print(e);
}
// Á¬½Ó
Connection conn = DriverManager.getConnection(SQL_CON_STRING,SQL_CON_USERNAME,SQL_CON_PASSWORD);
ResultSet rs = null;
PreparedStatement pstmt=conn.prepareStatement("insert into require_file(file_name,file_content) values(?,?)");
%><%
 int errorType_int =1;
    String msg = "";
    DiskFileUpload fu = new DiskFileUpload();
 
// ÉèÖÃÔÊÐíÓû§ÉÏ´«Îļþ´óС,µ¥Î»:×Ö½Ú
//fu.setSizeMax(2*1024*1024);//2m
// ÉèÖÃ×î¶àÖ»ÔÊÐíÔÚÄÚ´æÖд洢µÄÊý¾Ý,µ¥Î»:×Ö½Ú
 fu.setSizeThreshold(4096);
    // ÉèÖÃÒ»µ©Îļþ´óС³¬¹ýgetSizeThreshold()µÄֵʱÊý¾Ý´æ·ÅÔÚÓ²Å̵ÄĿ¼
    //(ÁÙʱ´æ·ÅĿ¼,ÎļþÉÏ´«Íê±ÏºóÓа취Çå³ýËüÂð£¿)
   // fu.setRepositoryPath("D:\\TEMP");
 
    //¿ªÊ¼¶ÁÈ¡ÉÏ´«ÐÅÏ¢
   


Ïà¹ØÎĵµ£º

5ÔÂ19ÈÕ JSP»ù´¡

1.essionÄڵĴæ·ÅµÄÊǶÔÏóµÄÒýÓÃ,ËùÒÔÐÞ¸ÄÄÚÖöÔÏóºó,²»ÐèÒªÖØзÅÖõ½sessionÖÐ
2.ÅäÖÃContext³õʼ»¯²ÎÊý
<Context-param>
<param-name></paran-name>
<param-value></param-value>
<Context-param>
this.getServletContext().getInitParameter(arg0);
--------------------- ......

JSPÁ¬½ÓSQL SERVER 2008 ÕÒ²»µ½Çý¶¯

ÄÄλ¸ßÊÖÄÜ°ïÎÒ¿´ÏÂΪʲôÅ׳öÕâЩÒì³££¿
´úÂë
<%@ page language="java" import="java.util.*" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="GB2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< ......

JSPÖж¨Ê±¹Ø±ÕÒ³ÃæµÄJS¿Ø¼þ


JS´úÂë
<script
type="text/javascript">
function closewindow(){
 window.returnValue = true;
 window.close();
}
function clock(){
 i = i -1;
 if(document.getElementById("info")){
  document.getElementById("info").innerHTML
......

JSP iterator


JSPÖнá¹û¼¯ÏÔʾÈçÏ£º
    
<
ww:iterator
 
value
=
"resultList"
 
status
=
"status"
>
    
<
tr
 
class
=
"<ww:if test="
#status.even"
>
row-even
</
ww:if
> ......

JSPÄÚÖöÔÏó

JSP µÄÄÚÖöÔÏóÓУºresquest ¡¢response¡¢session¡¢ application ¡¢out¡£ÒÔÏÂÎÒÃǽ«
Ò»Ò»½éÉÜ¡£
response ºÍrequest ¶ÔÏóÊÇJSP µÄÄÚÖöÔÏó½ÏÖØÒªµÄÁ½¸ö£¬ÕâÁ½¸ö¶ÔÏóÌṩÁ˶ԷþÎñ
Æ÷ºÍä¯ÀÀÆ÷ͨÐÅ·½·¨µÄ¿ØÖÆ¡£Ö±½ÓÌÖÂÛÕâÁ½¸ö¶ÔÏóÇ°£¬ÒªÏȶÔHTTP ЭÒé----Word Wide
Webµ×²ãЭÒé×÷¼òµ¥½éÉÜ¡£
Word Wide WebÊÇÔõÑùÔËÐеÄÄØ£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ