[color=red]注意[/color]
(1)这样写:则点击链接时,是从服务器的根目录进行的链接,
比如:localhost:8080/[color=red]projectName[/color]/yourAction.do?method=show&orgId=3
[code]<%String path="ProjectName";
String url="<a href=\""+path+"/yourAction.do?method=show&orgId="+d.getId()+"\" target=list>"+d.getProductNo()+"</a>";
%>[/code]
(2)如果这样写,则不正确了,系统是去找的相对于此代码所在的页面的相对路径.比如
localhost:8080/parentFolder/currentFolder/[color=red]projectName[/color]/yourAction.do?method=show&orgId=3
[code]<%String path="ProjectName";
String url="<a href=\""+path+"\yourAction.do?method=show&orgId="+d.getId()+"\" target=list>"+d.getProductNo()+"</a>";
%>[/code]
[color=red]注意:这两种写法只有一种区别,就是yourAction.do?之前的 斜杠/和反斜杠\的区别。写法1中用的是斜杠/而写法2中用的是\反斜杠[/color]
(1)这样写:则点击链接时,是从服务器的根目录进行的链接,
比如:localhost:8080/[color=red]projectName[/color]/yourAction.do?method=show&orgId=3
[code]<%String path="ProjectName";
String url="<a href=\""+path+"/yourAction.do?method=show&orgId="+d.getId()+"\" target=list>"+d.getProductNo()+"</a>";
%>[/code]
(2)如果这样写,则不正确了,系统是去找的相对于此代码所在的页面的相对路径.比如
localhost:8080/parentFolder/currentFolder/[color=red]projectName[/color]/yourAction.do?method=show&orgId=3
[code]<%String path="ProjectName";
String url="<a href=\""+path+"\yourAction.do?method=show&orgId="+d.getId()+"\" target=list>"+d.getProductNo()+"</a>";
%>[/code]
[color=red]注意:这两种写法只有一种区别,就是yourAction.do?之前的 斜杠/和反斜杠\的区别。写法1中用的是斜杠/而写法2中用的是\反斜杠[/color]
URL路径配置详解
112

被折叠的 条评论
为什么被折叠?



