锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成人一区二区,亚洲精品成人图区,亚洲国产成人精品无码区花野真一http://www.tkk7.com/qclass/category/9498.html瑙f斁鎬濇兂錛屽疄浜嬫眰鏄?/description>zh-cnFri, 02 Mar 2007 06:30:48 GMTFri, 02 Mar 2007 06:30:48 GMT60鍦↗SP閲岄潰鏄劇ず鐢辨暟鎹簱璇誨彇鍑烘潵鐨勫浘鐗囨暟鎹?/title><link>http://www.tkk7.com/qclass/articles/51911.html</link><dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator><author>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author><pubDate>Sat, 10 Jun 2006 15:55:00 GMT</pubDate><guid>http://www.tkk7.com/qclass/articles/51911.html</guid><wfw:comment>http://www.tkk7.com/qclass/comments/51911.html</wfw:comment><comments>http://www.tkk7.com/qclass/articles/51911.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/qclass/comments/commentRss/51911.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/qclass/services/trackbacks/51911.html</trackback:ping><description><![CDATA[ <p>鐜mysql+tomcat:</p> <p><1>鍏堝湪mysql涓嬪緩绔嬪涓嬬殑table. 騫秈nsert鍥懼儚.</p> <p>mysql.sql鏂囦歡濡備笅:</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff">CREATE</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">TABLE</span> <span style="COLOR: #000000">聽photo聽(<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />photo_no聽</span> <span style="FONT-WEIGHT: bold; COLOR: #000000">int</span> <span style="COLOR: #000000">(</span> <span style="FONT-WEIGHT: bold; COLOR: #800000">6</span> <span style="COLOR: #000000">)聽unsigned聽</span> <span style="COLOR: #808080">NOT</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">NULL</span> <span style="COLOR: #000000">聽auto_increment,<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="FONT-WEIGHT: bold; COLOR: #000000">image</span> <span style="COLOR: #000000">聽blob,<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /></span> <span style="COLOR: #0000ff">PRIMARY</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">KEY</span> <span style="COLOR: #000000">聽(`photo_no`)<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />)聽</span> </div> <p> <br /><2>鎶妔how.jsp鏀懼湪tomcat鐨勪換鎰忕洰褰曚笅. show.jsp浣滅敤:浠庢暟鎹簱涓鍑篵lob,騫朵駭鐢焛mage/jpg.</p> <p>show.jsp鏂囦歡濡備笅:</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000">@聽page聽contentType</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">text/html;聽charset=gbk</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000">@聽page聽</span> <span style="COLOR: #0000ff">import</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">java.io.*</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000">@聽page聽</span> <span style="COLOR: #0000ff">import</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">java.sql.*,聽javax.sql.*</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000">@聽page聽</span> <span style="COLOR: #0000ff">import</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">java.util.*</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000">@聽page聽</span> <span style="COLOR: #0000ff">import</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">java.math.*</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"><%</span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽String聽photo_no聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽request.getParameter(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">photo_no</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">mysql榪炴帴聽</span> <span style="COLOR: #008000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000">聽Class.forName(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">com.mysql.jdbc.Driver</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">).newInstance();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽String聽URL</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">jdbc:mysql://localhost:3306/job?user=root&password=111111</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽Connection聽con聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽DriverManager.getConnection(URL);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">oracle榪炴帴聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">String聽URL="jdbc:oracle:thin@localhost:1521:orcl2";<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">user="system";<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">password="manager";<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">Connection聽con聽=聽DriverManager.getConnection(URL,user,password);</span> <span style="COLOR: #008000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img id="Codehighlighter1_622_1165_Open_Image" onclick="this.style.display='none'; Codehighlighter1_622_1165_Open_Text.style.display='none'; Codehighlighter1_622_1165_Closed_Image.style.display='inline'; Codehighlighter1_622_1165_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_622_1165_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_622_1165_Closed_Text.style.display='none'; Codehighlighter1_622_1165_Open_Image.style.display='inline'; Codehighlighter1_622_1165_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />聽</span> <span style="COLOR: #0000ff">try</span> <span id="Codehighlighter1_622_1165_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_622_1165_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">聽鍑嗗璇彞鎵ц瀵硅薄</span> <span style="COLOR: #008000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #000000">聽聽Statement聽stmt聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽con.createStatement();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /><br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽String聽sql聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽SELECT聽*聽FROM聽PHOTO聽WHERE聽photo_no聽=聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽photo_no;<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽ResultSet聽rs聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽stmt.executeQuery(sql);<br /><img id="Codehighlighter1_806_1086_Open_Image" onclick="this.style.display='none'; Codehighlighter1_806_1086_Open_Text.style.display='none'; Codehighlighter1_806_1086_Closed_Image.style.display='inline'; Codehighlighter1_806_1086_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_806_1086_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_806_1086_Closed_Text.style.display='none'; Codehighlighter1_806_1086_Open_Image.style.display='inline'; Codehighlighter1_806_1086_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽</span> <span style="COLOR: #0000ff">if</span> <span style="COLOR: #000000">聽(rs.next())聽</span> <span id="Codehighlighter1_806_1086_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_806_1086_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽Blob聽b聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽rs.getBlob(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">photo_image</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽</span> <span style="COLOR: #0000ff">long</span> <span style="COLOR: #000000">聽size聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽b.length();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">out.print(size);</span> <span style="COLOR: #008000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" /> </span> <span style="COLOR: #000000">聽聽聽</span> <span style="COLOR: #0000ff">byte</span> <span style="COLOR: #000000">[]聽bs聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽b.getBytes(</span> <span style="COLOR: #000000">1</span> <span style="COLOR: #000000">,聽(</span> <span style="COLOR: #0000ff">int</span> <span style="COLOR: #000000">)size);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽response.setContentType(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">image/jpeg</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽OutputStream聽outs聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽response.getOutputStream();聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽outs.write(bs);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽outs.flush();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽rs.close();聽<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽}</span> </span> <span style="COLOR: #000000"> <br /> <img id="Codehighlighter1_1095_1162_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1095_1162_Open_Text.style.display='none'; Codehighlighter1_1095_1162_Closed_Image.style.display='inline'; Codehighlighter1_1095_1162_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /> <img id="Codehighlighter1_1095_1162_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1095_1162_Closed_Text.style.display='none'; Codehighlighter1_1095_1162_Open_Image.style.display='inline'; Codehighlighter1_1095_1162_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />聽聽</span> <span style="COLOR: #0000ff">else</span> <span style="COLOR: #000000">聽</span> <span id="Codehighlighter1_1095_1162_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1095_1162_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽rs.close();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽聽response.sendRedirect(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">./images/error.gif</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />聽聽}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />聽}</span> </span> <span style="COLOR: #000000"> <br /> <img id="Codehighlighter1_1175_1193_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1175_1193_Open_Text.style.display='none'; Codehighlighter1_1175_1193_Closed_Image.style.display='inline'; Codehighlighter1_1175_1193_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_1175_1193_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1175_1193_Closed_Text.style.display='none'; Codehighlighter1_1175_1193_Open_Image.style.display='inline'; Codehighlighter1_1175_1193_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />聽</span> <span style="COLOR: #0000ff">finally</span> <span id="Codehighlighter1_1175_1193_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"> <img src="http://www.tkk7.com/images/dot.gif" /> </span> <span id="Codehighlighter1_1175_1193_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://www.tkk7.com/images/OutliningIndicators/InBlock.gif" align="top" />聽聽con.close();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />聽}</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #000000">%></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <p> <br /><3>鎶婂涓嬫枃浠舵斁鍦╯how.jsp鐨勫悓涓鐩綍涓?</p> <p>index.html鏂囦歡濡備笅:</p> <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">HTML</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">HEAD</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TITLE</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">聽鍥懼儚嫻嬭瘯聽</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">TITLE</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">HEAD</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">BODY</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TABLE</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TR</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TD</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000">鍥懼儚嫻嬭瘯</span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">TD</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">TR</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TR</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"><</span> <span style="COLOR: #800000">TD</span> <span style="COLOR: #0000ff">><</span> <span style="COLOR: #800000">img聽</span> <span style="COLOR: #ff0000">src</span> <span style="COLOR: #0000ff">="show.jsp?photo_no=2"</span> <span style="COLOR: #0000ff">></</span> <span style="COLOR: #800000">TD</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">TR</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">TABLE</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">BODY</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> <span style="COLOR: #0000ff"></</span> <span style="COLOR: #800000">HTML</span> <span style="COLOR: #0000ff">></span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" /> </span> </div> <img src ="http://www.tkk7.com/qclass/aggbug/51911.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/qclass/" target="_blank">Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/a> 2006-06-10 23:55 <a href="http://www.tkk7.com/qclass/articles/51911.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>JSP甯哥敤闂瓟http://www.tkk7.com/qclass/articles/45115.htmlQ緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author>Mon, 08 May 2006 15:57:00 GMThttp://www.tkk7.com/qclass/articles/45115.htmlhttp://www.tkk7.com/qclass/comments/45115.htmlhttp://www.tkk7.com/qclass/articles/45115.html#Feedback0http://www.tkk7.com/qclass/comments/commentRss/45115.htmlhttp://www.tkk7.com/qclass/services/trackbacks/45115.html JSP甯哥敤闂瓟

1銆佸浣曟販鍚堜嬌鐢↗sp鍜孲SI #include?
鍦↗SP涓彲浠ヤ嬌鐢ㄥ涓嬫柟寮忓寘鍚函HTML錛?
<!--#include file="data.inc"-->
浣嗘槸濡傛灉data.inc涓寘鍚獼SP CODE 錛屾垜浠彲浠ヤ嬌鐢細
<%@include file="data.inc"%>


2銆佸浣曟墽琛屼竴涓嚎紼嬪畨鍏ㄧ殑JSP?
鍙渶澧炲姞濡備笅鎸囦護
<%@ page isThreadSafe="false" %>


3銆丣SP濡備綍澶勭悊HTML FORM涓殑鏁版嵁?
閫氳繃鍐呯疆鐨剅equest瀵硅薄鍗沖彲錛屽涓嬶細
<%
String item = request.getParameter("item");
int howMany = new Integer(request.getParameter("units")).intValue();
%>


4銆佸湪JSP濡備綍鍖呭惈涓涓潤鎬佹枃浠?
闈欐佸寘鍚涓嬶細<%@ include file="copyright.html" %>
鍔ㄦ佸寘鍚涓嬶細<jsp:include page="copyright.html" flush="true"/>


5銆佸湪JSP涓浣曚嬌鐢ㄦ敞閲?
涓昏鏈夊洓涓柟娉曪細
1銆?lt;%-- 涓?--%>
2銆?/
3銆?**涓?*/
4銆?lt;!--涓?->


6銆佸湪JSP涓浣曟墽琛屾祻瑙堥噸瀹氬悜?
浣跨敤濡備笅鏂瑰紡鍗沖彲錛歳esponse.sendRedirect("涔熻兘鐗╃悊鍦版敼鍙楬TTP HEADER灞炴э紝濡備笅錛?
<%
response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
String newLocn="/newpath/index.html";
response.setHeader("Location",newLocn);
%>


7銆佸浣曢槻姝㈠湪JSP鎴朣ERVLET涓殑杈撳嚭涓嶈BROWSER淇濆瓨鍦–ACHE涓?
鎶婂涓嬭剼鏈姞鍏ュ埌JSP鏂囦歡鐨勫紑濮嬪嵆鍙細
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>


8銆佸湪JSP涓浣曡緗瓹OOKIE?
COOKIE鏄綔涓篐TTP HEADER鐨勪竴閮ㄥ垎琚彂閫佺殑錛屽涓嬫柟娉曞嵆鍙緗細
<%
Cookie mycookie = new Cookie("aName","aValue");
response.addCookie(mycookie);
%>


9銆佸湪JSP涓浣曞垹闄や竴涓狢OOKIE?
<%
Cookie killMyCookie = new Cookie("mycookie", null);
killMyCookie.setMaxAge(0);
killMyCookie.setPath("/");
response.addCookie(killMyCookie);
%>


10銆佸湪涓涓狫SP鐨勮姹傚鐞嗕腑濡備綍鍋滄JSP鐨勬墽琛?
濡備笅渚嬶細
<%
if (request.getParameter("wen") != null) {
// do something
} else {
return;
}
%>


11銆佸湪JSP涓浣曞畾涔夋柟娉?
浣犲彲浠ュ畾涔夋柟娉曪紝浣嗘槸浣犱笉鑳界洿鎺ヨ闂甁SP鐨勫唴緗璞★紝鑰屾槸閫氳繃鍙傛暟鐨勬柟娉曚紶閫掋傚涓嬶細
<%!
public String howBadFrom(HttpServletRequest req) {
HttpSession ses = req.getSession();
...
return req.getRemoteHost();
}
%>
<%
out.print("in general,lao lee is not baddie ");
%>
<%= howBadFrom(request) %>


12銆佸鏋淏ROWSER宸插叧闂簡COOKIES錛屽湪JSP涓垜濡備綍鎵撳紑SESSION鏉ヨ窡韙?
浣跨敤URL閲嶅啓鍗沖彲錛屽涓嬶細
hello1.jsp
<%@ page session="true" %>
<%
Integer num = new Integer(100);
session.putValue("num",num);
String url =response.encodeURL("hello2.jsp");
%>
<a href=<%=url%>>hello2.jsp</a>

hello2.jsp
<%@ page session="true" %>
<%
Integer i= (Integer )session.getValue("num");
out.println("Num value in session is "+i.intValue());
%>


13銆佸湪JSP涓兘鍙戦丒MAIL鍚?
鍙互浣跨敤SUN鐨勪笓鐢ㄥ寘錛歴un.net.smtp鍖呫傚涓嬭剼鏈嬌鐢⊿mtpClient綾誨彂閫丒MAIL銆?
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from="
ybwen@sina.com";
String to="hewenjun@yeah.net, lei@who.com.cn";
try{
SmtpClient client = new SmtpClient("mail.xxxxx.xxx");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("Subject: Sending email from JSP!");
message.println("This was sent from a JSP page!");
message.println();
message.println("Cool! :-)");
message.println();
message.println("Good Boy");
message.println("Im in genius.com");
message.println();
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}
%>


14銆佸湪SERVLET涓垜鑳借皟鐢ㄤ竴涓狫SP閿欒欏靛悧
褰撶劧娌¢棶棰橈紝濡備笅灞曠ず浜嗗浣曞湪涓涓猄ERVLET鎺у埗閫昏緫鍗曞厓鍐呰皟鐢ㄤ竴涓狫SP閿欒欏甸潰銆?
protected void sendErrorRedirect(HttpServletRequest request,
HttpServletResponse response, String errorPageURL,
Throwable e)
throws ServletException, IOException {
request.setAttribute ("javax.servlet.jsp.jspException", e);
getServletConfig().getServletContext().
getRequestDispatcher(errorPageURL).forward(request,
response);
}

public void doPost(HttpServletRequest request,HttpServletResponse response) {
try {
// do something
} catch (Exception ex) {
try {
sendErrorRedirect(request,response,"/jsp/MyErrorPage.jsp",ex);
} catch (Exception e) {
e.printStackTrace();
}
}
}


15銆丣SP鍜孉PPLET濡備綍閫氳
JSP濡備綍涓嶦JB SessionBean閫氳
涓嬮潰鐨勪唬鐮佹浣滀簡寰堝ソ鐨勭ず鑼?
<%@ page import="javax.naming.*, javax.rmi.PortableRemoteObject,
foo.AccountHome, foo.Account" %>
<%!
//瀹氫箟涓涓SessionBeanHome鎺ュ彛瀹炰緥鐨勫叏灞寮曠敤
AccountHome accHome=null;

public void jspInit() {
//鑾峰緱Home鎺ュ彛瀹炰緥
InitialContext cntxt = new InitialContext( );
Object ref= cntxt.lookup("java:comp/env/ejb/AccountEJB");
accHome = (AccountHome)PortableRemoteObject.narrow(ref,AccountHome.class);
}
%>
<%
//瀹炰緥鍖朣essionBean
Account acct = accHome.create();
//璋冪敤榪滅▼鏂規硶
acct.doWhatever(...);
// 濡傛絳夌瓑
%>


16銆佸綋鎴戜嬌鐢ㄤ竴涓粨鏋滈泦鏃訛紝濡備綍闃叉瀛楁涓?null"鐨勫瓧鍩熸樉紺哄湪鎴戠殑HTML杈撳叆鏂囨湰鍩熶腑?
鍙互瀹氫箟涓涓畝鍗曠殑鍑芥暟鏉ヨ揪鍒扮洰鐨勶紝濡備笅錛?
<%!
String blanknull(String s) {
return (s == null) ? "" : s;
}
%>

鐒跺悗鍦↗SP鐨凢ORM涓紝鍙互榪欐牱浣跨敤
<input type="text" name="shoesize" value="<%=blanknull(shoesize)%>">


17銆佸浣曚腑SERVLET鎴朖SP涓嬭澆涓涓枃浠訛紙濡傦細binary,text,executable)錛?
鐜版彁渚涗袱涓В鍐蟲柟妗堬細
A錛氫嬌鐢℉TTP錛?
B錛氬湪Servlet涓紝閫氳繃璁劇疆ContentType鍜屼嬌鐢╦ava.io鍖呯殑Stream絳夌被鍙綔鍒?渚嬪錛?
response.setContentType("application/x-msword");
鐒跺悗鎯寵緭鍑虹紦鍐蹭腑鍐欎竴浜涗笢涓滃嵆鍙?

18銆佷嬌鐢╱seBean鏍囧織鍒濆鍖朆EAN鏃跺浣曟帴鍙楀垵濮嬪寲鍙傛暟
浣跨敤濡備笅涓ゆ爣絳懼嵆鍙細
<jsp:getProperty name="wenBean" property="someProperty"/>
<jsp:setProperty name="wenBean" property="someProperty" value="someValue"/>

19銆佷嬌鐢↗SP濡備綍鑾峰緱瀹㈡埛嫻忚鍣ㄧ殑淇℃伅錛?
浣跨敤request.getHeader(String)鍗沖彲


20銆佽兘璞¤皟鐢ㄥ瓙紼嬪簭涓鏍瘋皟鐢↗SP鍚楋紵
褰撶劧鍙互錛岀敤<jsp:include page="relativeURL" flush="true"/>


21銆佸綋鎴戦噸緙栬瘧鎴戠殑JSP浣跨敤鐨勪竴涓被鍚庯紝涓轟粈涔圝VM緇х畫浣跨敤鎴戠殑鑰丆LASS錛?


<%@include file="abc.jsp"%>涓?lt;jsp:include page="abc.jsp"/>涔嬮棿鐨勫樊鍒紵
鍓嶄竴涓負闈欐佸寘鍚紝鑰屽悗涓涓負鍔ㄦ佸寘鍚?


22銆丣SP鐨勭己鐐癸紵
1銆傚JAVA紼嬪簭榪涜璋冭瘯娌℃湁濂戒笢涓?
2銆傚洜澶у鏁扮殑servlet寮曟搸涓嶆敮鎸乧onnection pooling
3銆係ervlet寮曟搸娌℃湁鏍囧噯
4銆侸SP涓庡叾瀹冭剼鏈璦鐨勪氦浜?


23銆丣SP鑳借繘琛岄掑綊璋冪敤鍚楋紵
褰撶劧鍙互,濡傚form鐨勬彁浜ょ粰鏈〉


34銆佸浣曞疄鐜癑SP鐨勫浗闄呭寲錛?
涓哄悇縐嶇増鏈彁渚況esource bundles灞炴ф枃浠跺嵆鍙?

25銆佸湪JSP涓浣曞啓鏂囨湰鏂囦歡錛?
浣跨敤PrintWriter瀵硅薄錛屽錛?
<%@ page import="java.io.*" %>
<%
String str = "print me";
String nameOfTextFile = "/usr/anil/imp.txt";
try {
PrintWriter pw = new PrintWriter(new FileOutputStream(nameOfTextFile));
pw.println(str);
pw.close();
} catch(IOException e) {
out.println(e.getMessage());
}
%>


26銆佸浣曞湪JSP涓寘鎷粷瀵硅礬寰勬枃浠訛紵
浣跨敤URLConnection鍗沖彲銆?


27銆佸湪servlets鍜孞SP涔嬮棿鑳藉叡浜玸ession瀵硅薄鍚楋紵
褰撶劧鍙互錛?
HttpSession session = request.getSession(true);
session.putValue("variable","value");


28銆丣avaScript鐨勫彉閲忚兘澶嶅埗鍒癑SP鐨凷ESSION涓悧錛?


29銆佸浣曡緗甤ookie鍦ㄦ煇涓鏃墮棿鍚庤繃鏈燂紵
鐢–ookie.setMaxAge(int)


30銆佸浣曡幏寰楀綋鍓嶇殑sessions鏁幫紵
鍙互浣跨敤HttpSessionBindingListeners鏉ヨ窡韙?


31銆佽兘璁劇疆涓浜涗唬鐮佸湪鎴戞墍鏈夌殑JSP鏂囦歡涔嬩笂榪愯錛熷鏋滃彲浠ワ紝鑳藉叡浜悧錛?
褰撶劧鍙互,鍙互涓轟綘鐨凧SP鏂囦歡瀹氫箟涓涓埆鍚?/jsp/=ybwen.genius.myPreprocessingServlet,鑰屼互/jsp/涓哄墠緙鐨勬枃浠跺彲浠ヤ嬌鐢?


32銆佸涓涓狫SP欏碉紝濡傛灉澶氫釜瀹㈡埛绔悓鏃惰姹傚畠錛屽悓姝ュ彲鑳藉悧錛?
鍦╦sp:useBean璇硶涓嬌鐢╞eanName鏈変綍濂藉錛?
beanName浣跨敤Beans.instantiate()鍒濆鍖朆ean


33銆佸綋鎴戜嬌鐢?lt;jsp:forward>鏃訛紝鍦ㄦ祻瑙堝櫒鐨勫湴鍧鏍忔病鏈夋敼鍙橈紵
浣跨敤response.sendRedirect("newURL")


34銆佸浣曡漿鎹SP 0.9鐗堟湰鐨勬枃浠跺埌JSP1.1?
鍙嬌鐢╯ed/awk鍗沖彲


35銆佷嬌鐢↗SP鑳借緗瓾TML FORM涓緭鍏ュ煙鐨勭劍鐐癸紝涓嶇敤JavaScript?
娌″姙娉?


36銆佷嬌鐢↗SP榪炴帴鍒版暟鎹簱榪炴帴緙撳啿姹犵殑鏈濂芥柟娉曟槸浠涔堬紵
1.浣跨敤JDBC2銆?涓甫鏈夋鏈嶅姟鐨凞river
2.浣跨敤鎻愪緵鏈夋鏈嶅姟鐨凙pplication server
3.鑷繁鍐?/p>

]]>
浠嶶RL鑾峰彇鏂囦歡淇濆瓨鍒版湰鍦扮殑浠g爜http://www.tkk7.com/qclass/articles/39210.htmlQ緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author>Tue, 04 Apr 2006 09:09:00 GMThttp://www.tkk7.com/qclass/articles/39210.htmlhttp://www.tkk7.com/qclass/comments/39210.htmlhttp://www.tkk7.com/qclass/articles/39210.html#Feedback0http://www.tkk7.com/qclass/comments/commentRss/39210.htmlhttp://www.tkk7.com/qclass/services/trackbacks/39210.html <% @page聽 import = " java.net.*,java.io.* " %>
<%!
聽聽
public boolean 聽saveUrlAs(String聽photoUrl,聽String聽fileName)聽 {
// 姝ゆ柟娉曞彧鑳界敤鎴稨TTP鍗忚
聽聽聽聽 try {
聽聽聽聽聽聽URL聽url聽
= new 聽URL(photoUrl);
聽聽聽聽聽聽HttpURLConnection聽connection聽
= 聽(HttpURLConnection)聽url.openConnection();
聽聽聽聽聽聽DataInputStream聽in聽
= new 聽DataInputStream(connection.getInputStream());
聽聽聽聽聽聽DataOutputStream聽out聽
= new 聽DataOutputStream( new 聽FileOutputStream(fileName));
聽聽聽聽聽聽
byte []聽buffer聽 = new byte [ 4096 ];
聽聽聽聽聽聽
int 聽count聽 = 0 ;
聽聽聽聽聽聽
while 聽((count聽 = 聽in.read(buffer))聽 > 0 )聽 {
聽聽聽聽聽聽聽聽out.write(buffer,聽
0 ,聽count);
聽聽聽聽聽聽}

聽聽聽聽聽聽out.close();
聽聽聽聽聽聽in.close();
聽聽聽聽聽聽
return true ;
聽聽聽聽}

聽聽聽聽
catch 聽(Exception聽e)聽 {
聽聽聽聽聽聽
return false ;
聽聽聽聽}

聽聽}


public 聽String聽getDocumentAt(String聽urlString)聽 {
// 姝ゆ柟娉曞吋瀹笻TTP鍜孎TP鍗忚
聽聽聽聽StringBuffer聽document聽 = new 聽StringBuffer();
聽聽聽聽
try {
聽聽聽聽聽聽URL聽url聽
= new 聽URL(urlString);
聽聽聽聽聽聽URLConnection聽conn聽
= 聽url.openConnection();
聽聽聽聽聽聽BufferedReader聽reader聽
= new 聽BufferedReader( new 聽InputStreamReader(conn.
聽聽聽聽聽聽聽聽聽聽getInputStream()));
聽聽聽聽聽聽String聽line聽
= null ;
聽聽聽聽聽聽
while 聽(聽(line聽 = 聽reader.readLine())聽 != null )聽 {
聽聽聽聽聽聽聽聽document.append(line聽
+ " \n " );
聽聽聽聽聽聽}

聽聽聽聽聽聽reader.close();
聽聽聽聽}

聽聽聽聽
catch 聽(MalformedURLException聽e)聽 {
聽聽聽聽聽聽System.out.println(
" Unable聽to聽connect聽to聽URL:聽 " + 聽urlString);
聽聽聽聽}

聽聽聽聽
catch 聽(IOException聽e)聽 {
聽聽聽聽聽聽System.out.println(
" IOException聽when聽connecting聽to聽URL:聽 " + 聽urlString);
聽聽聽聽}

聽聽聽聽
return 聽document.toString();
聽聽}

%>
<%
// 嫻嬭瘯
聽聽String聽photoUrl聽 = " http://ad4.sina.com.cn/200601/12/43932_750450.jpg " ;
聽聽String聽fileName聽
= 聽photoUrl.substring(photoUrl.lastIndexOf( " / " ));
聽聽String聽filePath聽
= " d:/ghost/ " ;
聽聽
boolean 聽flag聽 = 聽saveUrlAs(photoUrl,聽filePath聽 + 聽fileName);
聽聽out.println(
" Run聽ok!\n<BR>Get聽URL聽file聽 " + 聽flag);
%>


]]>
瀹屾暣鐨勮幏鍙栧綋鍓峧sp鏂囦歡璺緞鐨勮鍙?/title><link>http://www.tkk7.com/qclass/articles/39211.html</link><dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator><author>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author><pubDate>Tue, 04 Apr 2006 09:09:00 GMT</pubDate><guid>http://www.tkk7.com/qclass/articles/39211.html</guid><wfw:comment>http://www.tkk7.com/qclass/comments/39211.html</wfw:comment><comments>http://www.tkk7.com/qclass/articles/39211.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/qclass/comments/commentRss/39211.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/qclass/services/trackbacks/39211.html</trackback:ping><description><![CDATA[ <div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <img id="Codehighlighter1_0_8_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_8_Open_Text.style.display='none'; Codehighlighter1_0_8_Closed_Image.style.display='inline'; Codehighlighter1_0_8_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /> <img id="Codehighlighter1_0_8_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_8_Closed_Text.style.display='none'; Codehighlighter1_0_8_Open_Image.style.display='inline'; Codehighlighter1_0_8_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /> <span id="Codehighlighter1_0_8_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span> <span id="Codehighlighter1_0_8_Open_Text"> <span style="COLOR: #008000">/*</span> <span style="COLOR: #008000">聽閿欒錛毬?/span> <span style="COLOR: #008000">*/</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />String聽realPath聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">http://</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerName()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">:</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerPort()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getContextPath();<br /><img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />String聽realPath聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">http://</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerName()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">:</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerPort()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServletPath();<br /><img id="Codehighlighter1_238_246_Open_Image" onclick="this.style.display='none'; Codehighlighter1_238_246_Open_Text.style.display='none'; Codehighlighter1_238_246_Closed_Image.style.display='inline'; Codehighlighter1_238_246_Closed_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_238_246_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_238_246_Closed_Text.style.display='none'; Codehighlighter1_238_246_Open_Image.style.display='inline'; Codehighlighter1_238_246_Open_Text.style.display='inline';" src="http://www.tkk7.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span> <span id="Codehighlighter1_238_246_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span> <span id="Codehighlighter1_238_246_Open_Text"> <span style="COLOR: #008000">/*</span> <span style="COLOR: #008000">聽姝g‘錛毬?/span> <span style="COLOR: #008000">*/</span> </span> <span style="COLOR: #000000"> <br /> <img src="http://www.tkk7.com/images/OutliningIndicators/None.gif" align="top" />String聽realPath聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">http://</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerName()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">:</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getServerPort()聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">聽request.getContextPath()</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">request.getServletPath().substring(</span> <span style="COLOR: #000000">0</span> <span style="COLOR: #000000">,request.getServletPath().lastIndexOf(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">/</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">)</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">1</span> <span style="COLOR: #000000">);聽</span> </div> <img src ="http://www.tkk7.com/qclass/aggbug/39211.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/qclass/" target="_blank">Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/a> 2006-04-04 17:09 <a href="http://www.tkk7.com/qclass/articles/39211.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>java榪炴帴Access鏁版嵁搴撶殑浠g爜http://www.tkk7.com/qclass/articles/39207.htmlQ緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author>Tue, 04 Apr 2006 09:07:00 GMThttp://www.tkk7.com/qclass/articles/39207.htmlhttp://www.tkk7.com/qclass/comments/39207.htmlhttp://www.tkk7.com/qclass/articles/39207.html#Feedback0http://www.tkk7.com/qclass/comments/commentRss/39207.htmlhttp://www.tkk7.com/qclass/services/trackbacks/39207.html import 聽java.sql. * ;
public class 聽dbaccess {
public static void 聽main(String聽args[])聽 throws 聽Exception {
聽聽Class.forName(
" sun.jdbc.odbc.JdbcOdbcDriver " );
聽聽String聽dburl聽
= " jdbc:odbc:driver={Microsoft聽Access聽Driver聽(*.mdb)};DBQ=Mobile.mdb " ; // 姝や負NO-DSN鏂瑰紡
聽聽
// String聽dburl聽="jdbc:odbc:odbcName"; // 姝や負ODBC榪炴帴鏂瑰紡
聽聽Connection聽conn = DriverManager.getConnection(dburl);
聽聽Statement聽stmt
= conn.createStatement();
聽聽ResultSet聽rs
= stmt.executeQuery( " select聽Top聽20聽*聽from聽MobileSection " );
聽聽System.out.println(
" 鍙鋒\t鍦板尯\t綾誨瀷\t鐪佷喚\t鍖哄彿 " );
聽聽
while (rs.next()) {
聽聽聽System.out.println(rs.getString(
1 ) + " \t " + rs.getString( 2 ) + " \t " + rs.getString( 3 ) + " \t " + rs.getString( 4 ) + " \t " + rs.getString( 5 ));
聽聽}

聽聽rs.close();
聽聽stmt.close();
聽聽conn.close();
聽}

}

榪愯緇撴灉錛?/div>
---------- Run Java ----------
鍙鋒聽鍦板尯聽綾誨瀷聽鐪佷喚聽鍖哄彿
1300566聽鑼傚悕聽騫夸笢鑱旈?30鍗÷犲箍涓溌?668
1300567聽鑼傚悕聽騫夸笢鑱旈?07鍗÷犲箍涓溌?668
1300568聽鑼傚悕聽騫夸笢鑱旈?07鍗÷犲箍涓溌?668
1300569聽鐝犳搗聽騫夸笢鑱旈?30鍗÷犲箍涓溌?756
1300570聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300571聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300572聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300573聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300574聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300575聽鎯犲窞聽騫夸笢鑱旈?30鍗÷犲箍涓溌?752
1300576聽鐝犳搗聽騫夸笢鑱旈?30鍗÷犲箍涓溌?756
1300577聽鐝犳搗聽騫夸笢鑱旈?30鍗÷犲箍涓溌?756
1300578聽鐝犳搗聽騫夸笢鑱旈?30鍗÷犲箍涓溌?756
1300579聽鐝犳搗聽騫夸笢鑱旈?30鍗÷犲箍涓溌?756



]]>Java璋冪敤windows紼嬪簭http://www.tkk7.com/qclass/articles/39204.htmlQ緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author>Tue, 04 Apr 2006 09:06:00 GMThttp://www.tkk7.com/qclass/articles/39204.htmlhttp://www.tkk7.com/qclass/comments/39204.htmlhttp://www.tkk7.com/qclass/articles/39204.html#Feedback0http://www.tkk7.com/qclass/comments/commentRss/39204.htmlhttp://www.tkk7.com/qclass/services/trackbacks/39204.html鐢變簬宸ヤ綔涓浣跨敤Java璋冪敤4U Wma Mp3 Converter鍛戒護琛屽皢vox鏍煎紡杞崲鎴怶MA鏍煎紡錛屼互鏂逛究鍦ㄧ綉欏典腑璇曞惉錛屾墍浠ユ兂鍒扮敤java.lang.Runtime鏉ュ鐞嗚繖涓棶棰樸傚湪浣跨敤榪囩▼涓鍒頒簡涓浜涗互鍓嶆病鏈夌暀鎰忕殑闂錛屾暣鐞嗗涓嬶細

涓 鏈綆鍗曠殑璋冪敤鏂瑰紡
String cmd="WMAMP3Converter.exe";
java.lang.Runtime.getRuntime().exec(cmd+" \""+filePath+"\" /wma");
鎬葷粨錛氭鏂規硶錛岃姹傚彲鎵ц鏂囦歡鍦═omcat鐨勫伐浣滅洰褰曚腑銆備竴鑸殑錛岀▼搴忓畨瑁呯洰褰曢兘鍦═omcat鐩綍涔嬪錛屾墍浠ヤ嬌鐢ㄧ粷瀵硅礬寰勬潵鏇夸唬浠ヤ笂鏂規銆?/p>

浜?浣跨敤鍏ㄨ礬寰勮皟鐢ㄥ彲鎵ц鏂囦歡
String cmd="C:\\WMA\\WMAMP3Converter.exe";
java.lang.Runtime.getRuntime().exec(cmd+" \""+filePath+"\" /wma");
鎬葷粨錛氭璋冪敤鏂瑰紡鎵ц娌℃湁闂錛屽悗鏉ユ祴璇曞畬鎴愬悗閮ㄧ講鍒版湇鍔″櫒涓婏紝鍙戠幇闂鍙堝嚭鏉ヤ簡錛岀▼搴忔墽琛岄敊璇傚垎鏋愬師鍥狅紝鍥犱負鏈湴嫻嬭瘯鍜屾湇鍔″櫒瀹夎璺緞涓嶅悓錛屾湇鍔″櫒瀹夎杞歡鐨勭洰褰曚負C:\Program Files\4U Computing\WMA MP3 Converter\錛岃繖閲岃礬寰勯噷鏈夌┖鏍鹼紝閫犳垚絀烘牸澶勬柇寮錛屾墍浠ュ懡浠よ鏃犳硶姝g‘鎴彇鍙傛暟銆?/p>

涓?瀹夊叏鐨勫叏璺緞鏂瑰紡璋冪敤鎵ц鏂囦歡
String cmd="\"C:\\Program Files\\4U Computing\\WMA MP3 Converter\\WMAMP3Converter.exe\"";
java.lang.Runtime.getRuntime().exec(cmd+" \""+filePath+"\" /wma");
鎬葷粨錛氬湪cmd涓蹭腑錛屾妸鍙墽琛屾枃浠剁殑鍏ㄨ礬寰勭敤鍙屽紩鍙峰寘鍚紝灝卞彲浠ヨВ鍐寵礬寰勩佹枃浠跺悕涓寘鍚┖鏍箋佸叏瑙掑瓧絎︾瓑闂銆?/p>

紼嬪簭榪愯涓孌墊椂闂翠互鍚庯紝鍙戠幇鏈夋椂鍊欑▼搴忔墽琛屽畬鍚庤漿鎹㈡枃浠舵病鏈夛紝紼嬪簭娌℃湁閿欒錛岃屼笖鏈嶅姟鍣ㄤ笂鏈夊緢澶氳繘紼嬫病鏈夌粨鏉熴傚師鏉ヨ皟鐢ㄥ彲鎵ц鏂囦歡澶辮觸浜嗭紝浣嗘槸紼嬪簭涓嶇煡閬擄紝浠ヤ負鎴愬姛浜嗭紝鐒跺悗緇х畫鍘繪壘杞崲鍚庣殑鏂囦歡鏉ユ挱鏀懼鑷村け璐ャ傚垎鏋愬師鍥狅紝鏄洜涓轟笂闈㈢殑鏂瑰紡寮傛鐨勶紝涔熷氨鏄java鎻愪氦榪愯鏂囦歡鐨勫懡浠や互鍚庯紝绔嬪嵆杞埌鎾斁妯″潡銆?br />瑙e喅鍔炴硶灝辨槸璁╁懡浠よ鍚屾鏂瑰紡鎵ц錛屼篃灝辨槸涓葷▼搴忕瓑寰呰皟鐢ㄥ彲鎵ц鏂囦歡緇撴潫浠ュ悗鍐嶆墽琛屻傦紙娉細褰撶劧錛屾挱鏀句箣鍓嶆鏌ユ枃浠舵槸鍚﹀瓨鍦ㄤ篃鏄彲浠ョ殑錛岃繖閲屾槸璇存槑鍚屾寮傛鐨勯棶棰樸傦級

鍥?寮傛鏂瑰紡璋冪敤澶栭儴鍙墽琛屾枃浠?br />Process process=null;
String cmd="\"C:\\Program Files\\4U Computing\\WMA MP3 Converter\\WMAMP3Converter.exe\"";
process = java.lang.Runtime.getRuntime().exec(cmd+" \""+filePath+"\" /wma");
process.waitFor();
鎬葷粨錛氭瀯閫犱竴涓狿rocess瀵硅薄錛屽皢榪愯榪涚▼鑾峰彇榪囨潵錛屾帶鍒惰繖涓繘紼嬬瓑寰呰皟鐢ㄧ粨鏉熷啀緇х畫榪愯銆侽K銆?/p>

浜?欏轟究璇翠竴涓嬶紝浣跨敤Process瀵硅薄浠ュ悗錛屽彲浠ョ敤濡備笅鏂規硶榪斿洖閿欒淇℃伅鍜岃緭鍑轟俊鎭紝鏉ヨ繘涓姝ユ帶鍒惰繘紼嬭繍琛屻?br />process.exitValue()
process.getErrorStream()
process.getInputStream()
process.getOutputStream()



]]>
Java緙╃暐鍥劇被http://www.tkk7.com/qclass/articles/39206.htmlQ緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/dc:creator>Q緋誨垪綾匯佹柟娉曘佸彉閲忊︹?/author>Tue, 04 Apr 2006 09:06:00 GMThttp://www.tkk7.com/qclass/articles/39206.htmlhttp://www.tkk7.com/qclass/comments/39206.htmlhttp://www.tkk7.com/qclass/articles/39206.html#Feedback0http://www.tkk7.com/qclass/comments/commentRss/39206.htmlhttp://www.tkk7.com/qclass/services/trackbacks/39206.html闃呰鍏ㄦ枃

]]>
主站蜘蛛池模板: 亚洲人成网站色在线观看| 亚洲第一精品电影网| 免费无码一区二区| 四虎永久精品免费观看| mm1313亚洲国产精品无码试看| 女人张开腿给人桶免费视频| 午夜在线a亚洲v天堂网2019| 免费鲁丝片一级观看| 国产AV旡码专区亚洲AV苍井空| 成年大片免费视频| 国产精品亚洲а∨无码播放不卡 | 51视频精品全部免费最新| 99ri精品国产亚洲| 97人伦色伦成人免费视频 | 久久久久亚洲AV成人片| 麻花传媒剧在线mv免费观看| 亚洲人成电影网站| 国产精品自在自线免费观看| 丰满少妇作爱视频免费观看| 亚洲国产精品无码久久久蜜芽| 日本免费一区二区三区四区五六区| 亚洲国产精品yw在线观看| 免费的一级片网站| 一级黄色免费大片| 精品亚洲成a人片在线观看| 性色av无码免费一区二区三区| 国产精品亚洲精品日韩动图| 久久亚洲高清观看| 在线观看特色大片免费视频| 美美女高清毛片视频黄的一免费 | 亚洲精品国产精品国自产网站| 国产免费变态视频网址网站| 免费久久人人爽人人爽av | 国产成人亚洲毛片| 亚洲av日韩av天堂影片精品| 国内大片在线免费看| 少妇性饥渴无码A区免费| 国产亚洲精品bv在线观看| jlzzjlzz亚洲乱熟在线播放| 91黑丝国产线观看免费| 人人爽人人爽人人片av免费 |