Re: [問題] URL(URL context, String spec) throws …
Each of the four URL constructors throws a MalformedURLException if the
arguments to the constructor refer to a null or unknown protocol.
引用你自已po出現網止最下方有講到 MalformedURLException
你在URL 這個constructor時都要用try/catch包起來做例外處理
原因上面那兩行英文跟你說了
※ oishii.bbs@ptt.cc (喔帥) wrote:
> ※ 引述《chh719 (逋逋狗)》之銘言:
> : URL(URL context,String spec)throws MalformedURLException
> : 這是一個建構URI的方法,看了書還有API可是不太懂這個方法怎樣建構耶.
> : String spec內要填入什麼東西呢??
> : 因為我想要將別的搜尋網站找到的東西,在我的網站上呈現.
> : 例如:
> : 使用者在我網站上下Query,我的網頁會去我指定的搜索引擎找
> : 結果會在我的網頁上呈現出來..
> : 這大概要如何做呢???請各位大大指教了
> 可以看看這個
> http://java.sun.com/docs/books/tutorial/networking/urls/creatingUrls.html
> 但我在Applet的init()函式內create一個URL物件
> 像這樣 URL u = new URL("http://www.nthu.edu.tw/")都會發生例外
> 我不大清楚原因^^" 放在start()內就沒問題了
--
◣ ███ ███ ☆ Post by oaqe
◢█ ▉▉█ █▇█ ★ From 218-165-101-104.dynamic.hinet.net
◥█◤ ﹉ ﹍ ﹋ 月光海洋BBS 《mobbs.stut.edu.tw》 163.26.220.130
討論串 (同標題文章)
java 近期熱門文章
PTT數位生活區 即時熱門文章