﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-IBMSOFT</title><link>http://www.blogjava.net/ibmsoft/</link><description>ibmsoft
努力不一定成功,放弃一定失败!
坚持自己的理想,实现自己的目标!
有好的想法就要出想办法实现!</description><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 06:00:13 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 06:00:13 GMT</pubDate><ttl>60</ttl><item><title>appfuse 再学习！</title><link>http://www.blogjava.net/ibmsoft/archive/2006/08/11/63038.html</link><dc:creator>ibmsoft</dc:creator><author>ibmsoft</author><pubDate>Fri, 11 Aug 2006 08:44:00 GMT</pubDate><guid>http://www.blogjava.net/ibmsoft/archive/2006/08/11/63038.html</guid><wfw:comment>http://www.blogjava.net/ibmsoft/comments/63038.html</wfw:comment><comments>http://www.blogjava.net/ibmsoft/archive/2006/08/11/63038.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ibmsoft/comments/commentRss/63038.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ibmsoft/services/trackbacks/63038.html</trackback:ping><description><![CDATA[好久没有学习搞web开发了，最近要弄一个东西，又把appfuse找出来进行研究<br /><br />用最新的appfuse1.9.3版本！<br /><br />到:http"://appfuse.org/下载appfuse1.93<br /><br />用idea打开<br />只需要修改properties.xml中的<br /><div style="border: 1px solid rgb(204, 204, 204); padding: 4px 5px 4px 4px; background-color: rgb(238, 238, 238); font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: rgb(0, 0, 0);">    </span><span style="color: rgb(0, 0, 0);">&lt;!--</span><span style="color: rgb(0, 0, 0);"> Defaults </span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);"> database.properties </span><span style="color: rgb(0, 0, 0);">--&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.jar</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> location</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">${mysql.jar}</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.type</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> value</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">mysql</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.name</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> value</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">appfuse</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.host</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> value</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">localhost</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.username</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> value</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">root</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span><span style="color: rgb(0, 0, 0);"><br />    </span><span style="color: rgb(0, 0, 0);">&lt;</span><span style="color: rgb(0, 0, 0);">property name</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">database.password</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> value</span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">root</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">/&gt;</span></div><br />把其中的localhost修改成实际的ip就ok了<br />比如说是：192.169.0.1:3306，注意一定要加上端口号！<br /><br />然后在ant中运行相关的任务：<br />我这里的情况是：<br />建数据库表和数据的不走是<br />运行 db－prepare－－》db－create－－》db－load，这样数据就建上了<br /><br />然后deploy，在ie中运行appfuse就ok了！<br /><img src ="http://www.blogjava.net/ibmsoft/aggbug/63038.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ibmsoft/" target="_blank">ibmsoft</a> 2006-08-11 16:44 <a href="http://www.blogjava.net/ibmsoft/archive/2006/08/11/63038.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>use google or baidu get the useful url</title><link>http://www.blogjava.net/ibmsoft/archive/2006/07/25/60029.html</link><dc:creator>ibmsoft</dc:creator><author>ibmsoft</author><pubDate>Tue, 25 Jul 2006 09:26:00 GMT</pubDate><guid>http://www.blogjava.net/ibmsoft/archive/2006/07/25/60029.html</guid><wfw:comment>http://www.blogjava.net/ibmsoft/comments/60029.html</wfw:comment><comments>http://www.blogjava.net/ibmsoft/archive/2006/07/25/60029.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ibmsoft/comments/commentRss/60029.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ibmsoft/services/trackbacks/60029.html</trackback:ping><description><![CDATA[
		<div style="BORDER-RIGHT: rgb(204,204,204) 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: rgb(204,204,204) 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: rgb(204,204,204) 1px solid; WIDTH: 98%; PADDING-TOP: 4px; BORDER-BOTTOM: rgb(204,204,204) 1px solid; BACKGROUND-COLOR: rgb(238,238,238)">
				<!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>-->
				<span style="COLOR: rgb(0,128,128)"> 1</span> <span style="COLOR: rgb(0,128,0)">/*</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)"> 2</span> <span style="COLOR: rgb(0,128,0)"> * Copyright (c) 2006 Your Corporation. All Rights Reserved.<br /></span><span style="COLOR: rgb(0,128,128)"> 3</span> <span style="COLOR: rgb(0,128,0)"> </span><span style="COLOR: rgb(0,128,0)">*/</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)"> 4</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">package</span><span style="COLOR: rgb(0,0,0)"> liuxuan;<br /></span><span style="COLOR: rgb(0,128,128)"> 5</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)"> 6</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,128,0)">/**</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)"> 7</span> <span style="COLOR: rgb(0,128,0)"> * Created by IntelliJ IDEA.<br /></span><span style="COLOR: rgb(0,128,128)"> 8</span> <span style="COLOR: rgb(0,128,0)"> * User: Administrator<br /></span><span style="COLOR: rgb(0,128,128)"> 9</span> <span style="COLOR: rgb(0,128,0)"> * Date: 2006-7-26<br /></span><span style="COLOR: rgb(0,128,128)">10</span> <span style="COLOR: rgb(0,128,0)"> * Time: 15:33:49<br /></span><span style="COLOR: rgb(0,128,128)">11</span> <span style="COLOR: rgb(0,128,0)"> * To change this template use File | Settings | File Templates.<br /></span><span style="COLOR: rgb(0,128,128)">12</span> <span style="COLOR: rgb(0,128,0)"> </span><span style="COLOR: rgb(0,128,0)">*/</span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">13</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.Node;<br /></span><span style="COLOR: rgb(0,128,128)">14</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.Parser;<br /></span><span style="COLOR: rgb(0,128,128)">15</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.http.ConnectionManager;<br /></span><span style="COLOR: rgb(0,128,128)">16</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.tags.LinkTag;<br /></span><span style="COLOR: rgb(0,128,128)">17</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.util.ParserException;<br /></span><span style="COLOR: rgb(0,128,128)">18</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> org.htmlparser.visitors.ObjectFindingVisitor;<br /></span><span style="COLOR: rgb(0,128,128)">19</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">20</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> java.sql.Statement;<br /></span><span style="COLOR: rgb(0,128,128)">21</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> java.sql.DriverManager;<br /></span><span style="COLOR: rgb(0,128,128)">22</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> java.sql.Connection;<br /></span><span style="COLOR: rgb(0,128,128)">23</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">import</span><span style="COLOR: rgb(0,0,0)"> java.sql.SQLException;<br /></span><span style="COLOR: rgb(0,128,128)">24</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">25</span> <span style="COLOR: rgb(0,0,0)"></span><span style="COLOR: rgb(0,0,255)">public</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">class</span><span style="COLOR: rgb(0,0,0)"> LinkDemo<br /></span><span style="COLOR: rgb(0,128,128)">26</span> <span style="COLOR: rgb(0,0,0)">{<br /></span><span style="COLOR: rgb(0,128,128)">27</span> <span style="COLOR: rgb(0,0,0)">    </span><span style="COLOR: rgb(0,0,255)">public</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">static</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">void</span><span style="COLOR: rgb(0,0,0)"> main (String[] args) </span><span style="COLOR: rgb(0,0,255)">throws</span><span style="COLOR: rgb(0,0,0)"> ParserException, SQLException<br /></span><span style="COLOR: rgb(0,128,128)">28</span> <span style="COLOR: rgb(0,0,0)">    {<br /></span><span style="COLOR: rgb(0,128,128)">29</span> <span style="COLOR: rgb(0,0,0)">        ConnectionManager cn </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> ConnectionManager();<br /></span><span style="COLOR: rgb(0,128,128)">30</span> <span style="COLOR: rgb(0,0,0)">        cn.setProxyHost(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">10.75.1.38</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">31</span> <span style="COLOR: rgb(0,0,0)">        cn.setProxyPort(</span><span style="COLOR: rgb(0,0,0)">80</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">32</span> <span style="COLOR: rgb(0,0,0)">        Parser.setConnectionManager(cn);<br /></span><span style="COLOR: rgb(0,128,128)">33</span> <span style="COLOR: rgb(0,0,0)">        Parser parser;<br /></span><span style="COLOR: rgb(0,128,128)">34</span> <span style="COLOR: rgb(0,0,0)">        </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">parser.s</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)">35</span> <span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(0,0,0)">        String[] pyurl </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> String[</span><span style="COLOR: rgb(0,0,0)">2</span><span style="COLOR: rgb(0,0,0)">] ;<br /></span><span style="COLOR: rgb(0,128,128)">36</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">37</span> <span style="COLOR: rgb(0,0,0)">        pyurl[</span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)">]</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">http://www.google.cn/search?num=100&amp;hl=zh-CN&amp;newwindow=1&amp;q=%E6%BF%AE%E9%98%B3&amp;btnG=%E6%90%9C%E7%B4%A2&amp;meta=cr%3DcountryCN</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /></span><span style="COLOR: rgb(0,128,128)">38</span> <span style="COLOR: rgb(0,0,0)">        pyurl[</span><span style="COLOR: rgb(0,0,0)">1</span><span style="COLOR: rgb(0,0,0)">]</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">http://www.google.cn/search?q=%E6%BF%AE%E9%98%B3&amp;num=100&amp;hl=zh-CN&amp;lr=&amp;cr=countryCN&amp;newwindow=1&amp;start=100&amp;sa=N</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /></span><span style="COLOR: rgb(0,128,128)">39</span> <span style="COLOR: rgb(0,0,0)">        </span><span style="COLOR: rgb(0,0,255)">for</span><span style="COLOR: rgb(0,0,0)"> (</span><span style="COLOR: rgb(0,0,255)">int</span><span style="COLOR: rgb(0,0,0)"> j</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)">;j</span><span style="COLOR: rgb(0,0,0)">&lt;</span><span style="COLOR: rgb(0,0,0)">pyurl.length;j</span><span style="COLOR: rgb(0,0,0)">++</span><span style="COLOR: rgb(0,0,0)">) {<br /></span><span style="COLOR: rgb(0,128,128)">40</span> <span style="COLOR: rgb(0,0,0)">            parser </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> Parser (pyurl[j]);<br /></span><span style="COLOR: rgb(0,128,128)">41</span> <span style="COLOR: rgb(0,0,0)">            ObjectFindingVisitor visitor </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">new</span><span style="COLOR: rgb(0,0,0)"> ObjectFindingVisitor (LinkTag.</span><span style="COLOR: rgb(0,0,255)">class</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">42</span> <span style="COLOR: rgb(0,0,0)">            parser.visitAllNodesWith (visitor);<br /></span><span style="COLOR: rgb(0,128,128)">43</span> <span style="COLOR: rgb(0,0,0)">            Node[] links </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> visitor.getTags ();<br /></span><span style="COLOR: rgb(0,128,128)">44</span> <span style="COLOR: rgb(0,0,0)">            String sql;<br /></span><span style="COLOR: rgb(0,128,128)">45</span> <span style="COLOR: rgb(0,0,0)">                </span><span style="COLOR: rgb(0,0,255)">try</span><span style="COLOR: rgb(0,0,0)"> {<br /></span><span style="COLOR: rgb(0,128,128)">46</span> <span style="COLOR: rgb(0,0,0)">                        Class.forName(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">com.mysql.jdbc.Driver</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">47</span> <span style="COLOR: rgb(0,0,0)">                    } </span><span style="COLOR: rgb(0,0,255)">catch</span><span style="COLOR: rgb(0,0,0)"> (ClassNotFoundException e) {<br /></span><span style="COLOR: rgb(0,128,128)">48</span> <span style="COLOR: rgb(0,0,0)">                        e.printStackTrace();  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">To change body of catch statement use File | Settings | File Templates.</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)">49</span> <span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(0,0,0)">                    }<br /></span><span style="COLOR: rgb(0,128,128)">50</span> <span style="COLOR: rgb(0,0,0)">                    Connection conn </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,255)">null</span><span style="COLOR: rgb(0,0,0)">;<br /></span><span style="COLOR: rgb(0,128,128)">51</span> <span style="COLOR: rgb(0,0,0)">                    </span><span style="COLOR: rgb(0,0,255)">try</span><span style="COLOR: rgb(0,0,0)"> {<br /></span><span style="COLOR: rgb(0,128,128)">52</span> <span style="COLOR: rgb(0,0,0)">                        conn </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> DriverManager.getConnection(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">jdbc:mysql://localhost:3306/crawdb</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">, </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">root</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">, </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">root</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">53</span> <span style="COLOR: rgb(0,0,0)">                    } </span><span style="COLOR: rgb(0,0,255)">catch</span><span style="COLOR: rgb(0,0,0)"> (SQLException e) {<br /></span><span style="COLOR: rgb(0,128,128)">54</span> <span style="COLOR: rgb(0,0,0)">                        e.printStackTrace();  </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">To change body of catch statement use File | Settings | File Templates.</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)">55</span> <span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(0,0,0)">                    }<br /></span><span style="COLOR: rgb(0,128,128)">56</span> <span style="COLOR: rgb(0,0,0)">             Statement stmt </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> conn.createStatement();<br /></span><span style="COLOR: rgb(0,128,128)">57</span> <span style="COLOR: rgb(0,0,0)">            </span><span style="COLOR: rgb(0,0,255)">for</span><span style="COLOR: rgb(0,0,0)"> (</span><span style="COLOR: rgb(0,0,255)">int</span><span style="COLOR: rgb(0,0,0)"> i </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)">; i </span><span style="COLOR: rgb(0,0,0)">&lt;</span><span style="COLOR: rgb(0,0,0)"> links.length; i</span><span style="COLOR: rgb(0,0,0)">++</span><span style="COLOR: rgb(0,0,0)">)<br /></span><span style="COLOR: rgb(0,128,128)">58</span> <span style="COLOR: rgb(0,0,0)">            {<br /></span><span style="COLOR: rgb(0,128,128)">59</span> <span style="COLOR: rgb(0,0,0)">                    sql</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">""</span><span style="COLOR: rgb(0,0,0)">;<br /></span><span style="COLOR: rgb(0,128,128)">60</span> <span style="COLOR: rgb(0,0,0)">                LinkTag linkTag </span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)"> (LinkTag)links[i];<br /></span><span style="COLOR: rgb(0,128,128)">61</span> <span style="COLOR: rgb(0,0,0)">                </span><span style="COLOR: rgb(0,0,255)">if</span><span style="COLOR: rgb(0,0,0)"> (linkTag.getLink().indexOf(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">cache</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">)</span><span style="COLOR: rgb(0,0,0)">&lt;</span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">&amp;&amp;</span><span style="COLOR: rgb(0,0,0)">  linkTag.getLink().indexOf(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">google</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">)</span><span style="COLOR: rgb(0,0,0)">&lt;</span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)"> </span><span style="COLOR: rgb(0,0,0)">&amp;&amp;</span><span style="COLOR: rgb(0,0,0)">linkTag.getLinkText().indexOf(</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">濮阳</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">)</span><span style="COLOR: rgb(0,0,0)">&gt;</span><span style="COLOR: rgb(0,0,0)">0</span><span style="COLOR: rgb(0,0,0)">)  {<br /></span><span style="COLOR: rgb(0,128,128)">62</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">63</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">64</span> <span style="COLOR: rgb(0,0,0)">                      sql</span><span style="COLOR: rgb(0,0,0)">=</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">insert into urls(name,note,url) values('</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">linkTag.getLinkText ()</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">','</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">lixuan</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">','</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">linkTag.getLink ()</span><span style="COLOR: rgb(0,0,0)">+</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">')</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">;<br /></span><span style="COLOR: rgb(0,128,128)">65</span> <span style="COLOR: rgb(0,0,0)">                      stmt.executeUpdate(sql);<br /></span><span style="COLOR: rgb(0,128,128)">66</span> <span style="COLOR: rgb(0,0,0)">                        </span><span style="COLOR: rgb(0,128,0)">//</span><span style="COLOR: rgb(0,128,0)">rs.close();</span><span style="COLOR: rgb(0,128,0)"><br /></span><span style="COLOR: rgb(0,128,128)">67</span> <span style="COLOR: rgb(0,128,0)"></span><span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">68</span> <span style="COLOR: rgb(0,0,0)">                    System.out.print (</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">\</span><span style="COLOR: rgb(0,0,0)">""</span><span style="COLOR: rgb(0,0,0)"> + linkTag.getLinkText () + </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">\</span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)"> =&gt; </span><span style="COLOR: rgb(0,0,0)">"</span><span style="COLOR: rgb(0,0,0)">);<br /></span><span style="COLOR: rgb(0,128,128)">69</span> <span style="COLOR: rgb(0,0,0)">                System.out.println (linkTag.getLink ());<br /></span><span style="COLOR: rgb(0,128,128)">70</span> <span style="COLOR: rgb(0,0,0)">                }<br /></span><span style="COLOR: rgb(0,128,128)">71</span> <span style="COLOR: rgb(0,0,0)">            }<br /></span><span style="COLOR: rgb(0,128,128)">72</span> <span style="COLOR: rgb(0,0,0)">             stmt.close();<br /></span><span style="COLOR: rgb(0,128,128)">73</span> <span style="COLOR: rgb(0,0,0)">             conn.close();<br /></span><span style="COLOR: rgb(0,128,128)">74</span> <span style="COLOR: rgb(0,0,0)">        }<br /></span><span style="COLOR: rgb(0,128,128)">75</span> <span style="COLOR: rgb(0,0,0)">    }<br /></span><span style="COLOR: rgb(0,128,128)">76</span> <span style="COLOR: rgb(0,0,0)"><br /></span><span style="COLOR: rgb(0,128,128)">77</span> <span style="COLOR: rgb(0,0,0)">}<br /></span><span style="COLOR: rgb(0,128,128)">78</span> <span style="COLOR: rgb(0,0,0)"></span></div>
		<br />
<img src ="http://www.blogjava.net/ibmsoft/aggbug/60029.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ibmsoft/" target="_blank">ibmsoft</a> 2006-07-25 17:26 <a href="http://www.blogjava.net/ibmsoft/archive/2006/07/25/60029.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Nutch Cache Page picture problem</title><link>http://www.blogjava.net/ibmsoft/archive/2006/06/28/55609.html</link><dc:creator>ibmsoft</dc:creator><author>ibmsoft</author><pubDate>Wed, 28 Jun 2006 13:03:00 GMT</pubDate><guid>http://www.blogjava.net/ibmsoft/archive/2006/06/28/55609.html</guid><wfw:comment>http://www.blogjava.net/ibmsoft/comments/55609.html</wfw:comment><comments>http://www.blogjava.net/ibmsoft/archive/2006/06/28/55609.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/ibmsoft/comments/commentRss/55609.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ibmsoft/services/trackbacks/55609.html</trackback:ping><description><![CDATA[
		<ul>
				<li>I use nutch to crawl the intranet.but you know ,the cache.jsp have mang problem (X).Because I filter the gif|jgf and so on<br />then I use ORO replace the html content use my customer pif<br />Code:<br /><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"><span style="COLOR: #008080"> 1</span><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><span style="COLOR: #000000">    String sRegexpSrc</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">src\\s*=\\s*\</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">([a</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">z]</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">]+)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 2</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    String sRegxpBackground </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">background\\s*=\\s*\</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">([a</span><span style="COLOR: #000000">-</span><span style="COLOR: #000000">z]</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">]+)</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 3</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    String sAdd </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 4</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    String sNewContent</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">""</span><span style="COLOR: #000000">;<br /></span><span style="COLOR: #008080"> 5</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    PatternCompiler compiler </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Perl5Compiler();<br /></span><span style="COLOR: #008080"> 6</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    Pattern pattern </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000">,pattern1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">null</span><span style="COLOR: #000000"> ;<br /></span><span style="COLOR: #008080"> 7</span><span style="COLOR: #000000"><img id="Codehighlighter1_290_456_Open_Image" onclick="this.style.display='none'; Codehighlighter1_290_456_Open_Text.style.display='none'; Codehighlighter1_290_456_Closed_Image.style.display='inline'; Codehighlighter1_290_456_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_290_456_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_290_456_Closed_Text.style.display='none'; Codehighlighter1_290_456_Open_Image.style.display='inline'; Codehighlighter1_290_456_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    </span><span style="COLOR: #0000ff">try</span><span id="Codehighlighter1_290_456_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.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_290_456_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080"> 8</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        pattern </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> compiler.compile(sRegexpSrc,Perl5Compiler.CASE_INSENSITIVE_MASK);<br /></span><span style="COLOR: #008080"> 9</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        pattern1 </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> compiler.compile(sRegxpBackground,Perl5Compiler.CASE_INSENSITIVE_MASK);<br /></span><span style="COLOR: #008080">10</span><span style="COLOR: #000000"><img id="Codehighlighter1_492_521_Open_Image" onclick="this.style.display='none'; Codehighlighter1_492_521_Open_Text.style.display='none'; Codehighlighter1_492_521_Closed_Image.style.display='inline'; Codehighlighter1_492_521_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_492_521_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_492_521_Closed_Text.style.display='none'; Codehighlighter1_492_521_Open_Image.style.display='inline'; Codehighlighter1_492_521_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" />    }</span></span><span style="COLOR: #0000ff">catch</span><span style="COLOR: #000000"> (MalformedPatternException e)</span><span id="Codehighlighter1_492_521_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.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_492_521_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">11</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        <br /></span><span style="COLOR: #008080">12</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />        e.printStackTrace();<br /></span><span style="COLOR: #008080">13</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />    }</span></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">14</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" />    PatternMatcher matcher </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Perl5Matcher();<br /></span><span style="COLOR: #008080">15</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/None.gif" align="top" /><br /></span><span style="COLOR: #008080">16</span><span style="COLOR: #000000"><img id="Codehighlighter1_609_1035_Open_Image" onclick="this.style.display='none'; Codehighlighter1_609_1035_Open_Text.style.display='none'; Codehighlighter1_609_1035_Closed_Image.style.display='inline'; Codehighlighter1_609_1035_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_609_1035_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_609_1035_Closed_Text.style.display='none'; Codehighlighter1_609_1035_Open_Image.style.display='inline'; Codehighlighter1_609_1035_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (matcher.contains(content, pattern))</span><span id="Codehighlighter1_609_1035_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.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_609_1035_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">17</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                    MatchResult result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> matcher.getMatch();<br /></span><span style="COLOR: #008080">18</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">System.out.println(result.toString());</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">19</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                    sAdd </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> result.group(</span><span style="COLOR: #000000">1</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">result.group(</span><span style="COLOR: #000000">2</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">result.group(</span><span style="COLOR: #000000">3</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">20</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">System.out.println("sAdd= "+sAdd);</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">21</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000">                    sNewContent</span><span style="COLOR: #000000">=</span><span style="COLOR: #000000">content.replaceAll(sAdd,</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">\\img\\liuxuan</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);<br /></span><span style="COLOR: #008080">22</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />                    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">System.out.println("FinalString="+sTest.replaceAll(sAdd,"/img/liuxuan.png"));<br /></span><span style="COLOR: #008080">23</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">System.out.print("sTest= "+result.group(1)+"/"+result.group(2));</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">24</span><span style="COLOR: #008000"><img id="Codehighlighter1_1040_1094_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1040_1094_Open_Text.style.display='none'; Codehighlighter1_1040_1094_Closed_Image.style.display='inline'; Codehighlighter1_1040_1094_Closed_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1040_1094_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1040_1094_Closed_Text.style.display='none'; Codehighlighter1_1040_1094_Open_Image.style.display='inline'; Codehighlighter1_1040_1094_Open_Text.style.display='inline';" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span><span style="COLOR: #000000">        }</span></span><span style="COLOR: #0000ff">else</span><span id="Codehighlighter1_1040_1094_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.blogjava.net/images/dot.gif" /></span><span id="Codehighlighter1_1040_1094_Open_Text"><span style="COLOR: #000000">{<br /></span><span style="COLOR: #008080">25</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" />            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">System.out.print("Can't find the String ");</span><span style="COLOR: #008000"><br /></span><span style="COLOR: #008080">26</span><span style="COLOR: #008000"><img src="http://www.blogjava.net/images/OutliningIndicators/InBlock.gif" align="top" /></span><span style="COLOR: #000000"><br /></span><span style="COLOR: #008080">27</span><span style="COLOR: #000000"><img src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />        }</span></span></div><br /></li>
		</ul>
<img src ="http://www.blogjava.net/ibmsoft/aggbug/55609.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ibmsoft/" target="_blank">ibmsoft</a> 2006-06-28 21:03 <a href="http://www.blogjava.net/ibmsoft/archive/2006/06/28/55609.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Java实现利用搜索引擎收集网址的程序</title><link>http://www.blogjava.net/ibmsoft/archive/2006/06/14/52834.html</link><dc:creator>ibmsoft</dc:creator><author>ibmsoft</author><pubDate>Wed, 14 Jun 2006 11:50:00 GMT</pubDate><guid>http://www.blogjava.net/ibmsoft/archive/2006/06/14/52834.html</guid><wfw:comment>http://www.blogjava.net/ibmsoft/comments/52834.html</wfw:comment><comments>http://www.blogjava.net/ibmsoft/archive/2006/06/14/52834.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.blogjava.net/ibmsoft/comments/commentRss/52834.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/ibmsoft/services/trackbacks/52834.html</trackback:ping><description><![CDATA[
		<table class="blueBox" border="0">
				<tbody>
						<tr>
								<td width="558">
										<div class="mainbody">
												<div class="blogpost partsmb" id="rtebox" style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px">
														<div class="MSN_EDITCONTAINER"> </div>
												</div>
										</div>
								</td>
						</tr>
						<tr>
								<td style="BORDER-RIGHT: rgb(232,232,232) 1px solid; BORDER-LEFT: rgb(232,232,232) 1px solid" align="middle" bgcolor="#f9f9f9" colspan="3">
										<table cellspacing="0" cellpadding="0" width="700" align="center" border="0">
												<tbody>
														<tr bgcolor="#f9f9f9">
																<td style="LINE-HEIGHT: 200%">
																		<p>我这里讲的不是怎么使用搜索引擎，而是怎么让程序利用搜索引擎来搜集网址，这有什么用？很有用！网上动辄有人叫卖网址数据库，如发布软件网址、邮件地址、论坛网址、行业网址，这些网址是怎么来的呢？不可能是人手工收集而来的，都是让程序利用搜索引擎取到的，如果您需要某类网址信息数据，就跟我来一起研究一下，非常简单。</p>
																		<p>　　本文采用Java语言写成，以google和百度搜索引擎为对象。</p>
																		<p>　　我们要利用google、百度搜索引擎的搜索规则中的两条，关键字搜索和inurl搜索。什么是inurl搜索，就是你所要搜索的网址中本身带有的关键字，比如http://www.xxx.com/post.asp ,这个网址就含有post.asp这样的关键字，在搜索引擎中填写规则是 inurl:post.asp,这是收集网址的关键，因为很多网址本身会带有特定的信息，比如软件发布的网页网址信息中多含有 publish、submit、tuijian这样的信息，如http://www.xxx.com/publish.asp,这样的网址多是发布信息的网页，在结合网页中本身可能含有的关键字，就可以用搜索引擎搜索出结果，然后我们利用程序将结果取回，对HTML页面进行分析，去除没有用的信息，将有用的网址信息写入文件或者数据库，就可以给其它应用程序或者人来使用了。</p>
																		<p>　　第一步，用程序将搜索结果取回，先以百度为例，比如我们要搜索软件发布的网页，关键字采用 “软件发布 版本 inurl:publish.asp",先登录百度看看，将关键字写入，然后提交，在地址栏就会看到 http://www.baidu.com/s?ie=gb2312&amp;bs=%C8%ED%BC%FE%B7%A2%B2%BC+%C8%ED%BC%FE%B0%E6%B1%BE+inurl%3Apublish.asp&amp;sr=&amp;z=&amp;cl=3&amp;f=8&amp;wd=%C8%ED%BC%FE%B7%A2%B2%BC+%B0%E6%B1%BE+inurl%3Apublish.asp&amp;ct=0 ,中文关键字全都变成编码了，没有关系，我们在程序中直接用中文也是可以的，其中多个关键字用＋号相连，去掉一些没有用的信息，我们可以把地址优化成 http://www.baidu.com/s?lm=0&amp;si=&amp;rn=20&amp;ie=gb2312&amp;ct=0&amp; wd=软件发布+版本+inurl%3Apublish%2Easp&amp;pn=0&amp;cl=0，其中rn表示一页显示多少个结果，wd=表示你要搜索的关键字，pn表示从第几条开始显示，这个pn将是我们程序循环取结果的变量，每20条循环一次。我们用Java写的程序来模拟这个搜索的过程，用到的关键类为 java.net.HttpURLConnection,java.net.URL，先写一个提交搜索的class,关键代码如下：</p>
																		<p>class Search<br />{<br />　public URL url;<br />　public HttpURLConnection http;<br />　public java.io.InputStream urlstream;<br />　......<br />　for(int i=0;i++;i &lt;100)<br />　{<br />　　......<br />　　try {<br />　　　url = new URL("www.baidu.com/s?lm=0&amp;si=&amp;rn=20&amp;ie=gb2312&amp;ct=0&amp; wd=软件发布+版本+inurl%3Apublish%2Easp&amp;pn="+beginrecord+"&amp;cl=0");<br />　　}catch(Exception ef){};<br />　　try {<br />　　　http = (HttpURLConnection) url.openConnection();<br />　　　http.connect();<br />　　　urlstream = http.getInputStream();<br />　　}catch(Exception ef){};<br />　　java.io.BufferedReader l_reader = new java.io.<br />　　BufferedReader(new java.io.InputStreamReader(urlstream));<br />　　try {<br />　　　while ((currentLine = l_reader.readLine()) != null) {<br />　　　　totalstring += currentLine;<br />　　　}<br />　　} catch (IOException ex3) {}<br />　　....<br />　　//本次搜索的结果已经放到totalstring中了，是一些HTML代码，需要下一步进行分析了。<br />}<br />　　再以google为例，稍微有些不同，google对浏览器进行了一些检测，编码也不同，URL为http: //www.google.com/search?q=软件发布+版本+inurl:publish.asp&amp;hl=zh-CN&amp;lr= &amp;newwindow=1&amp;start=0&amp;sa=N&amp;ie=UTF-8,其中编码要用ie=UTF-8,start表示从第几条记录显示，需要注意的是google对浏览器还要检查，如果浏览器不符合它的要求，将返回错误代码，所以在模拟浏览器提交中，我们要多加一行代码，修改关键部分要将http属性中的User-Agent设置为常用的浏览器，比如Mozilla/4.0,代码如下：</p>
																		<p>try {<br />　http = (HttpURLConnection) url.openConnection();<br />　http.setRequestProperty("User-Agent", "Mozilla/4.0");<br />　http.connect();<br />　urlstream = http.getInputStream();<br />}catch(Exception ef){};</p>
																		<p>　　第二步，对取回的HTML编码进行分析，取出其中的有用网址信息，并写入文件或者数据库，由于这些搜索引擎都有网页快照和相似网页等网址信息混杂在HTML中，我们要将这些网址信息剔除掉，剔除的关键就是找出其中的规律，百度搜索引擎中的网页快照和其它没有用的的地址都含有baidu这个关键字，而google中含有的无用网址信息含有关键字 google和cache,我们就根据这些关键字剔除无用网址信息。在Java中要对字符串进行分析必然要用到 java.util.StringTokenize这个类，用来将字符串以特定的分隔符分开，java.util.regex.Pattern和 java.util.regex.Matcher用来匹配字符串，关键代码如下：</p>
																		<p>class CompareStr<br />{<br />　public boolean comparestring(String oristring,String tostring)<br />　{<br />　　Pattern p=null; //正则表达式<br />　　Matcher m=null; //操作的字符串<br />　　boolean b;<br />　　p = Pattern.compile(oristring,Pattern.CASE_INSENSITIVE);<br />　　m = p.matcher(tostring);<br />　　b = m.find();<br />　　return b;<br />　}<br />}</p>
																		<p>class AnalyUrl<br />{<br />　......<br />　StringTokenizer token = new StringTokenizer(totalstring," &lt;&gt; \"");<br />　String firstword;<br />　CompareStrcompstr = new CompareStr();<br />　String dsturl = null;<br />　while (token.hasMoreTokens())<br />　{<br />　　firstword = token.nextToken();<br />　　if (!compstr.comparestring("google.com", firstword) &amp;&amp; !compstr.comparestring("cache",firstword))<br />　　{<br />　　　if (firstword.length() &gt; 7)<br />　　　{<br />　　　　dsturl = firstword.substring(6,firstword.length() - 1);<br />　　　　WriteUrl(dsturl); //成功取到URL，记录到文件中<br />　　　}<br />　　}<br />　}<br />}<br />　　通过以上程序，我们就可以收集到自己要的网址信息了，还可以再写另外一个应用程序，对收集到的网址信息进一步分析，取出自己需要的信息，这里就不再累赘，道理都是一样的。最后需说明一点，google搜索引擎搜索所能返回的结果不能超过1000条，过了1000条，就直接提示“对不起， Google 为所有查询的结果数都不会超过 1000 个。”，百度搜索引擎返回的结果不能超过700多条，所以我们要搜索时尽可能多加关键字，将结果范围缩小。</p>
																</td>
														</tr>
												</tbody>
										</table>
								</td>
						</tr>
						<tr>
								<td width="10" height="11">
										<img height="11" src="http://www.javafan.net/article/images/u_16.gif" width="10" />
								</td>
								<td style="BORDER-BOTTOM: rgb(232,232,232) 1px solid" width="695" bgcolor="#f9f9f9" height="11">
										<img height="1" src="http://www.javafan.net/article/20051223151611967.html" width="1" />
								</td>
						</tr>
						<div>
						</div>
						<div>
						</div>
						<div>
						</div>
						<div>
						</div>
						<div>
								<div class="MSN_EDITCONTAINER">
										<div class="MSN_EDITBOX" contenteditable="true" style="OVERFLOW: auto; WIDTH: 422px; HEIGHT: 44px">
												<div>come from </div>
												<div>
														<a href="http://www.javafan.net/article/20051223151611967.html">
																<font color="#095801">http://www.javafan.net/article/20051223151611967.html</font>
														</a>
												</div>
												<div>
														<font color="#095801">
														</font> </div>
												<div>
														<font color="#095801">
														</font>
												</div>
										</div>
								</div>
						</div>
				</tbody>
		</table>
<img src ="http://www.blogjava.net/ibmsoft/aggbug/52834.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/ibmsoft/" target="_blank">ibmsoft</a> 2006-06-14 19:50 <a href="http://www.blogjava.net/ibmsoft/archive/2006/06/14/52834.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>