由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - what's wrong with this?
相关主题
jdbc连接数据库出现的问题InetAddress.getLocalHost() in Ubuntu does not work
请教获取URL地址的问题Is MappedByteBuffer.putInt atomic?
Core Java2 Notes (2)Re: serverlet
How to connect to SQL2000?Re: Why my url can not open a connection to my servlet in a web browse
Socket Connection refused in high-loaded serversRe: how to connect to oracle using servlet?
请问JDBC连SQL server的connect reset问题如何解决? (转载)Re: access host file in applet
求救:Connection Pooling 没有close resultset 怎么解决JMIT v0.0.0.00002
JFTP 0.0.3 releaseJMIT v0.1 UPDATE
相关话题的讨论汇总
话题: url话题: wrong话题: what话题: like
进入Java版参与讨论
1 (共1页)
r*****r
发帖数: 397
1
想表达如果相对地址以 \ 开头,like \data.html
if (addr.startsWith("\\")) // url like /data.html
{
String baseurl2 = baseurl.getHost();
URL relativeURL = new URL(baseurl2+addr);
}
else //url like data.htm, relative url
{
relativeURL = new URL(baseurl+addr);
}
when there is a relateive url named /data.html, it didn't go to if section,
but go to else section, made a result like
htt://www....//data.html
error in connecting.
What's wrong with the expression?SHould be sth wrong with "\\" here, how to
use escape
F****n
发帖数: 3271
2
1. I never saw URL like \data.html
always use "/" instead of "\"
2. Look at URI.resolve, it does the right things.

【在 r*****r 的大作中提到】
: 想表达如果相对地址以 \ 开头,like \data.html
: if (addr.startsWith("\\")) // url like /data.html
: {
: String baseurl2 = baseurl.getHost();
: URL relativeURL = new URL(baseurl2+addr);
: }
: else //url like data.htm, relative url
: {
: relativeURL = new URL(baseurl+addr);
: }

1 (共1页)
进入Java版参与讨论
相关主题
JMIT v0.1 UPDATESocket Connection refused in high-loaded servers
Re: 关于APPLET的IO问题请问JDBC连SQL server的connect reset问题如何解决? (转载)
Re: 恳请各位JAVA大师:有没有这样一个东西?求救:Connection Pooling 没有close resultset 怎么解决
[转载] JDBC of Oracle9iRelease2JFTP 0.0.3 release
jdbc连接数据库出现的问题InetAddress.getLocalHost() in Ubuntu does not work
请教获取URL地址的问题Is MappedByteBuffer.putInt atomic?
Core Java2 Notes (2)Re: serverlet
How to connect to SQL2000?Re: Why my url can not open a connection to my servlet in a web browse
相关话题的讨论汇总
话题: url话题: wrong话题: what话题: like