JSF2.0 相当于 HTML 锚标记的是什么

发布于 2024-12-17 02:13:01 字数 637 浏览 1 评论 0原文

当我按如下方式使用 h:link 标记时,JSF 系统报告为 此链接已禁用,因为导航案例无法匹配。

<h:link rendered="#{empty applicationScope.rendered ? false : true}" disabled="#{applicationScope.disabled eq 'true' ? true : false}" outcome="http://www.myblogname.blogspot.com/" >
 <h:graphicImage url="#{applicationScope.url}"    alt="#{applicationScope.alt}" title="#{applicationScope.title}" styleClass="rGap ui-corner-all" />  
</h:link>

它似乎正在搜索内部导航案例,但如何指定外部超链接?

问题摘要: 以下 HTML 的 JSF 等效项是什么?

<a href="http://www.amazon.com" > Amazon </a>

When I use the h:link tag as follows, the JSF system reports as This link is disabled because a navigation case could not be matched.

<h:link rendered="#{empty applicationScope.rendered ? false : true}" disabled="#{applicationScope.disabled eq 'true' ? true : false}" outcome="http://www.myblogname.blogspot.com/" >
 <h:graphicImage url="#{applicationScope.url}"    alt="#{applicationScope.alt}" title="#{applicationScope.title}" styleClass="rGap ui-corner-all" />  
</h:link>

It seems it is searching for an internal navigation case, but how can I specify an external hyperlink?

Summery of the question:
What is the JSF equivalent of the following HTML?

<a href="http://www.amazon.com" > Amazon </a>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

木槿暧夏七纪年 2024-12-24 02:13:01

尝试使用 h:outputLink 标签。使用 value 属性指定渲染的 href

<h:outputLink id="amazonLink" value="http://www.amazon.com">
  Amazon
</h:outputLink>

应该可以像这样调整您的示例代码:

<h:outputLink 
  rendered="#{empty applicationScope.rendered ? false : true}" 
  disabled="#{applicationScope.disabled eq 'true' ? true : false}" 
  value="http://www.myblogname.blogspot.com/">
    <h:graphicImage 
      url="#{applicationScope.url}" 
      alt="#{applicationScope.alt}" 
      title="#{applicationScope.title}" 
      styleClass="rGap ui-corner-all" />  
</h:outputLink>

注意:我不认为 h:outputLink 标记有 disabled 属性,因此将其设置为 true 或 false(如上面的代码示例中所示)可能不会产生效果。您必须尝试一下才能看到。

正如 @Matteo 在评论中指出的那样,disabled 属性应该与 h:outputLink 标记一起使用。

Try using the h:outputLink tag. Use value attribute to specify the rendered href.

<h:outputLink id="amazonLink" value="http://www.amazon.com">
  Amazon
</h:outputLink>

It should be possible to adapt your sample code like this:

<h:outputLink 
  rendered="#{empty applicationScope.rendered ? false : true}" 
  disabled="#{applicationScope.disabled eq 'true' ? true : false}" 
  value="http://www.myblogname.blogspot.com/">
    <h:graphicImage 
      url="#{applicationScope.url}" 
      alt="#{applicationScope.alt}" 
      title="#{applicationScope.title}" 
      styleClass="rGap ui-corner-all" />  
</h:outputLink>

Note: I don't think the h:outputLink tag has a disabled attribute, so setting it to true or false (like in your code sample above) may not have an effect. You'll have to try it and see.

As @Matteo brought out in a comment, the disabled attribute should work with the h:outputLink tag.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文