Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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");
 
    //¿ªÊ¼¶ÁÈ¡ÉÏ´«ÐÅÏ¢
   


Ïà¹ØÎĵµ£º

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ÄÚÖöÔÏó

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

JSPÄÚÖöÔÏóÖ®request

HTTP ͨÐÅЭÒéÊÇ¿Í»§Óë·þÎñÆ÷Ö®¼äÒ»ÖÖÌá½»£¨ÇëÇó£© ÐÅÏ¢ÓëÏìÓ¦ÐÅÏ¢
£¨request/respone£©µÄͨÐÅЭÒé¡£ÔÚJSP ÖУ¬ÄÚÖöÔÏórequest ·â×°ÁËÓû§Ìá½»µÄÐÅÏ¢£¬
ÄÇô¸Ã¶ÔÏóµ÷ÓÃÏàÓ¦µÄ·½·¨¿ÉÒÔ»ñÈ¡·â×°µÄÐÅÏ¢£¬¼´Ê¹ÓøöÔÏó¿ÉÒÔ»ñÈ¡Óû§Ìá½»µÄÐÅ
Ï¢¡£
¿Í»§Í¨³£Ê¹ÓÃHTML ±íµ¥Ïò·þÎñÆ÷µÄij¸öJSP Ò³ÃæÌá½»ÐÅÏ¢£¬±íµ¥µÄÒ»°ã¸ñʽÊÇ£º ......

jspÉú³Éhtml¾²Ì¬Ò³Ãæ´úÂë

<%@ page contentType="text/html;charset=GBK"%>
<%@page import="java.util.*"%>
<%@page import="java.io.*" %>
<%
//ÔÚÕâÀïÈç¹ûд³É“WEB-INF\templates\template.htm”³ÌÐò»á±¨´í
 String filePath = request.getRealPath("/")+"WEB-INF/templates/template.htm"; &nbs ......

JSPÁ¬½Ó¸÷ÀàÊý¾Ý¿â·½·¨´óÈ«

Ò»¡¢jspÁ¬½ÓOracle8/8i/9iÊý¾Ý¿â£¨ÓÃthinģʽ£©
¡¡¡¡testoracle.jspÈçÏ£º
¡¡¡¡<%@ page contentType="text/html;charset=gb2312"%>
¡¡¡¡<%@ page import="java.sql.*"%>
¡¡¡¡<html>
¡¡¡¡<body>
¡¡¡¡<%Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
¡¡¡¡Stri ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ