ÓÃJSPÀ´ÊµÏÖÎļþÏÂÔØ¹¦Äܵļ¸ÖÖ·½Ê½
1.×îÖ±½Ó×î¼òµ¥µÄ£¬·½Ê½ÊǰÑÎļþµØÖ·Ö±½Ó·Åµ½htmlÒ³ÃæµÄÒ»¸öÁ´½ÓÖС£ÕâÑù×öµÄȱµãÊǰÑÎļþÔÚ·þÎñÆ÷ÉϵÄ·¾¶±©Â¶ÁË£¬²¢ÇÒ»¹ÎÞ·¨¶ÔÎļþÏÂÔØ½øÐÐÆäËüµÄ¿ØÖÆ£¨ÈçȨÏÞ£©¡£Õâ¸ö¾Í²»Ð´Ê¾ÀýÁË¡£
2.ÔÚ·þÎñÆ÷¶Ë°ÑÎļþת»»³ÉÊä³öÁ÷£¬Ð´Èëµ½response£¬ÒÔresponse°ÑÎļþ´øµ½ä¯ÀÀÆ÷£¬ÓÉä¯ÀÀÆ÷À´ÌáʾÓû§ÊÇ·ñÔ¸Òâ±£´æÎļþµ½±¾µØ¡£
3.¼ÈÈ»ÊÇ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.setRequestProperty(\"Content-Type\",\"application/octet-stream\");
InputStream in = con.getInputStream();
ProgressMonitorInputStream pmInputStream = new ProgressMonitorInputStream(pane, \"ÕýÔÚ´Ó·þÎñÆ÷ÏÂÔØÎļþÄÚÈÝ\", in);
ProgressMonitor pMonitor = pmInputStream.getProgressMonitor();
pMonitor.setMillisToDecideToPopup(3);
pMonitor.setMillisToPopup(3);//localfilepath±¾µØÂ·¾¶,localstrÎļþÎļþ¼Ð£¬filename±¾µØÎļþÃû
String localfilepath = localstr filename ;//·½·¨saveFilsaveFileeÊǰÑÊäÈëÁ÷pmInputStreamдµ½ÎļþlocalfilepathÖÐ
if(saveFilsaveFilee(localfilepath,pmInputStream)){¡¡¡¡¡¡¡¡ openLocalFile(localfilepath);
} URLConnection con;
try {
con = url.openConnection();//urlÊDZ»µ÷ÓõÄSERVLETµÄÍøÖ· Èç *.do ¡¡¡¡
con.setUseCaches(false);
con.setDoInput(true);
con.setDoOutput(true);
con.setRequestProperty(\"Content-Type\",\"application/octet-stream\");
OutputSt
Ïà¹ØÎĵµ£º
¡¡¡¡1 Javascript £¬ÉèÖÃÒ»¸ö±äÁ¿£¬Ö»ÔÊÐíÌá½»Ò»´Î¡£
¡¡¡¡#lt;script language="javascript"#gt;
¡¡¡¡ var checkSubmitFlg = false;
¡¡¡¡ function checkSubmit() {
¡¡¡¡ if (checkSubmitFlg == true) {
¡¡¡¡ return false;
¡¡¡¡ }
¡¡¡¡ checkSubmitFlg = true;
¡¡¡¡ return true;
¡¡¡¡ }
¡¡¡¡ document.ondblcli ......
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......
»ù±¾ÄÚÈÝ
Ê×ÏÈÊÇÓÃJ2SE+TOMCAT´î½¨¿ª·¢Æ½Ì¨£¬È»ºó»áÓÃʵÀý·Ö±ð¶ÔjavabeanºÍservlet½øÐвâÊÔ£¬
ͬʱҲ»á̸µ½Ò»Ð©ÖÐÎÄ´¦ÀíÉϵÄÎÊÌâ¡£ÎÄÕÂÄÚÈÝ¿ÉÄÜ»áÓеãÔÓÂÒºÍÁãÉ¢£¬µ«ÕâÒ²ÊÇѧϰ
jsp×î»ù´¡µÄ֪ʶ£¬ÒªÏëѧºÃjsp»¹µÃ¿¿×Ô¼º¶àŬÁ¦Ñ§Ï°¡£
ΪʲôҪдÕâÑùһƪÎÄÕ£¿
ÈÏʶÎÒµÄÅóÓÑ¿ÉÄÜ»áÖªµÀ£¬ÎÒÆ½Ê±Ö»ÊÇдºÍ·ÒëһЩJ2ME· ......
JSP¹²ÓÐÒÔÏÂ9ÖÖ»ù±¾ÄÚÖÃ×é¼þ£¨¿ÉÓëASPµÄ6ÖÖÄÚ²¿×é¼þÏà¶ÔÓ¦£©£º
¡¡1.request Óû§¶ËÇëÇ󣬴ËÇëÇó»á°üº¬À´×ÔGET/POSTÇëÇóµÄ²ÎÊý¡£
2. response ÍøÒ³´«»ØÓû§¶ËµÄ»ØÓ¦ ¡£
3.pageContext ÍøÒ³µÄÊôÐÔÊÇÔÚÕâÀï¹ÜÀí ¡£
4.session ÓëÇëÇóÓйصĻỰÆÚ¡£
5.ap ......