List Grails-在gsp中引用绝对URL
在my index.gsp中,对于表的一个列值,我提供了以下内容:List Grails-在gsp中引用绝对URL,list,url,grails,hyperlink,tags,List,Url,Grails,Hyperlink,Tags,在my index.gsp中,对于表的一个列值,我提供了以下内容: <td><g:link action = "redirect(url: 'http://www.google.com')">www.google.com</g:link></td> 避免在开始时包含基本url的解决方法是什么。我希望链接是绝对URL-> http://www.google.com 根据下面的一些评论,以下作品-> <td><a href='h
<td><g:link action = "redirect(url: 'http://www.google.com')">www.google.com</g:link></td>
避免在开始时包含基本url的解决方法是什么。我希望链接是绝对URL->
http://www.google.com
根据下面的一些评论,以下作品->
<td><a href='http://www.google.com'>www.google.com</a></td>
如何消除对以下基本URL的引用
http://localhost:8080/APP_NAME/
使用标准HTML的标记锚定
<a href='http://www.google.com'>www.google.com</a>
编辑
您可以更改:
<td><a href=${fieldValue(bean: testRunInstance, field: "artifactLink")}>${fieldValue(bean: testRunInstance, field: "artifactLink")}</a></td>
作者:
或者这个,如果你想
www.google.com
我想你可以用
<g:link url="http://www.google.com">www.google.com</g:link>
www.google.com
//示例,其中artifactLink有一个值ddg.gg
${bean.artifactLink}
//产生
//例如,其中artifactLink有一个值,http://ddg.gg
${bean.artifactLink}
//产生
//例如,其中artifactLink有一个值,https://ddg.gg
${bean.artifactLink}
//产生
当遇到uri
值前面的协议时,它会完全忽略base
属性。注意,在第二个示例中,它没有重复http://,而在最后一个示例中使用了http://
此外,您可以指定target=“\u blank”
,以便在新选项卡或窗口中加载页面
注意:应该适用于Grails3.2或>只是出于好奇:如果我们这样做的话。将gsp解析为html会对性能产生影响(显然是最小的)?确实有,但与应用程序的所有其他区域相比,它太小了,甚至在您分析应用程序并查找瓶颈时都不会显示出来。您的建议会导致链接->“:www.google.com,绝对值:true)”是的,你的“动作”参数绝对是错误的。只需使用锚或g的url参数:link@chandragaajula不客气。为了遵守StackOverflow规则,我建议您删除您的答案。删除我的答案。谢谢
<a href='http://www.google.com'>www.google.com</a>
<td><a href=${fieldValue(bean: testRunInstance, field: "artifactLink")}>${fieldValue(bean: testRunInstance, field: "artifactLink")}</a></td>
<td>
<a href="http://${testRunInstance.artifactLink}">
${fieldValue(bean: testRunInstance, field: "artifactLink")}
</a>
</td>
<g:link url="http://www.google.com">www.google.com</g:link>
<g:link url="http://www.google.com">www.google.com</g:link>
// Example, where artifactLink has a value, ddg.gg
<g:link base="http://" uri="${bean.artifactLink}">${bean.artifactLink}</g:link>
// Generates
<a href="http://ddg.gg">ddg.gg</a>
// Example, where artifactLink has a value, http://ddg.gg
<g:link base="http://" uri="${bean.artifactLink}">${bean.artifactLink}</g:link>
// Generates
<a href="http://ddg.gg">http://ddg.gg</a>
// Example, where artifactLink has a value, https://ddg.gg
<g:link base="http://" uri="${bean.artifactLink}">${bean.artifactLink}</g:link>
// Generates
<a href="https://ddg.gg">https://ddg.gg</a>