ÀûÓÃJ2MEÓëASP½¨Á¢Êý¾Ý¿âÁ¬½Ó
¡¡¡¡ J2MEÊÇÀûÓÃHttpConnection½¨Á¢HTTPÁ¬½Ó£¬È»ºó»ñÈ¡Êý¾Ý£¬ASPÒ²ÊÇÀûÓÃHTTPÐÒ飬Òò¶ø¿ÉÒÔÀûÓÃJ2MEÓëASP½¨Á¢Á¬½Ó£¬´Ó¶ø·ÃÎÊÊý¾Ý¿â¡£
¡¡¡¡ ASPÊÇMicroSoft¹«Ë¾µÄ·þÎñÆ÷¶Ë¶¯Ì¬Ò³Ãæ¼¼Êõ£¬¿ÉÒÔ¸ù¾ÝÇëÇóÔËÐзþÎñÆ÷¶Ë³ÌÐòÈ»ºó·µ»Ø½á¹û£¬ÕâÒ²¸øMIDPÌṩºÜ¶àÓÐÓõŦÄÜ¡£ÓÉÓÚMIDP¿Í»§¶Ë´¦ÀíÄÜÁ¦²»Ç¿£¬Òò´Ë¿ÉÒÔ°ÑһЩ´¦ÀíÈÎÎñ·ÅÔÚ·þÎñÆ÷¶Ë£¬ÀûÓÃASPÍê³ÉһЩËü²»ÄÜÍê³ÉµÄÈÎÎñ£¬Èç²Ù×÷Êý¾Ý¿â¡£
¡¡¡¡ ÕâÀï¸ø³öÒ»¸ö¼òµ¥µÄÀý×Ó£¬ËµÃ÷MIDPÈçºÎÓëASP½øÐн»»¥£¬Íê³ÉÊý¾Ý¿â²Ù×÷¡£
¡¡¡¡ £¨1£©È·±£IIS¡¡WEB·þÎñÆ÷Õý³£¹¤×÷¡£
¡¡¡¡ £¨2£©½¨Á¢Ò»¸ö²âÊÔÊý¾Ý¿â
¡¡¡¡ ²ÉÓÃACCESSÊý¾Ý¿â£¬Éú³ÉÒ»¸öÊý¾Ý¿âÎļþ±£´æµ½D:\J2ME\J2METEST\IIS\DATEBASEÖУ¬ÎļþÃûÊÇJ2MEtest.mdb.È»ºóн¨Ò»¸öÊý¾Ý¿â±í£Message,´´½¨µÄ±í°üº¬ÒÔÏÂ×ֶΣºID£¨×Ô¶¯±àºÅ£©¡¢MESSAGE£¨Îı¾£©¡¢IP£¨Îı¾£©¡¢DATE£¨ÈÕÆÚ£©¡£
¡¡¡¡ £¨3£©´´½¨ASP³ÌÐò
¡¡¡¡ ÒÔÏÂÊÇASP³ÌÐòÔ´´úÂ룬ÎļþÃûΪConnectASP.asp,±£´æµ½D:\J2ME\J2METEST\IIS\ASPÖС£
¡¡¡¡ //ConnectASP.asp
<%@LANGUAGE=VBScript%>
<%
strDBLocation=Server.Mappath("/database/j2meTest.mdb");
strConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+strDBLocation;
var cnn=Server.CreateObject("ADODB.Connection");
cnn.Open(strConnectionString);
rs=Server.CreateObject("ADODB.Recordset");
ip=Request.ServerVariables("REMOTE_ADDR");
message=Request.QueryString("message");
rs.ActiveConnection=cnn;
rs.CursorType=1;
rs.LockType=2;
rs.Source="Message";
rs.Open();
rs.AddNew();
rs("Message")=message;
rs("IP")=ip;
rs("Date")=(new Date()).getVarDate();
rs.Update();
rs.Close();
cnn.Close();
Response.Write("The message writed successfully.\n");
%>
¡¡¡¡ È»ºóÔÚä¯ÀÀÆ÷ÖÐÊäÈëÒÔÏÂURL£ºÌæ»»www.pcxue.com/asp/ConnectASP.asp?message=Hello+J2ME!
Èç¹ûÔËÐгɹ¦£¬ä¯ÀÀÆ÷»áÊä³öÓï¾ä“The message weited successfully.”£¬È»ºó´ò¿ªÊý¾Ý¿âÎļþ²é¿´±íMESSAGE£¬Ò»Ìõ¼Ç¼ÒѾ³É¹¦Ð´Èë¡£IDΪ1£¬MessageΪHello J2ME£¬IPΪ127.0.0.1£¬DATEΪµ±Ç°ÈÕÆÚ¡£
¡¡¡¡ £¨4£©±àдMIDlet³ÌÐò
¡¡¡¡ ½ÓÏÂÀ´±àдMIDP³ÌÐò£¬ÔÚMIDletÖн¨Á¢Ò»¸öHTTPÁ¬½Ó£¬ÆäURIÖ¸ÏòÕâ¸öASPÎļþ£¬²¢¸½´ø²ÎÊý¡£
¡¡¡¡ //ConnectASP.java
import javax.mi
Ïà¹ØÎĵµ£º
ASP±à³ÌÖÐ20¸ö·Ç³£ÓÐÓõÄÀý×Ó
1.ÈçºÎÓÃAspÅжÏÄãµÄÍøÕ¾µÄÐéÄâÎïÀí·¾¶
´ð£ºÊ¹ÓÃMappath·½·¨
<%= Server.MapPath("\")%>
2.ÎÒÈçºÎÖªµÀʹÓÃÕßËùÓõÄä¯ÀÀÆ÷£¿
´ð£ºÊ¹ÓÃthe Request object·½·¨
strBrowser=Request.ServerVariables("HTTP_USER_AGENT")
If Instr(strBrowser,"MSIE") & ......
http://www.w3school.com.cn/asp/met_mappath.asp
¶¨ÒåºÍÓ÷¨
MapPath ·½·¨¿É°ÑÖ¸¶¨µÄ·¾¶Ó°Éäµ½·þÎñÆ÷ÉÏÏàÓ¦µÄÎïÀí·¾¶ÉÏ¡£
×¢ÊÍ£º´Ë·½·¨²»ÄÜÓÃÓÚ Session.OnEnd ºÍ Application.OnEnd ÖС£
ʵÀý
ʵÀý 1
¾ÙÀý£¬Îļþ test.asp λÓÚ C:\Inetpub\wwwroot\Script¡£
Îļþ Test.asp (λÓÚ C:\Inetpub\wwwroot\Script) °üº ......
<%
'©³©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©¥©·
'©§¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡©§
'©§ Õª¡¡Òª£º ͳ¼Æͼ--ÇúÏßͼ &n ......