看板java
标 题Re: [问题] URL(URL context, String spec) throws …
发信站月光海洋BBS (Fri Mar 24 01:10:30 2006)
转信站ptt!ctu-reader!news.nctu!mobbs
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所以没问题可以compile
你在applet中同样的也是需要这样子做
原因上面那两行英文跟你说了
※ [email protected] (喔帅) 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