h:link 和 h:outputLink 的区别 [英] Difference between h:link and h:outputLink

查看:20
本文介绍了h:link 和 h:outputLink 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了这两个组件的 API,但不太确定您为什么要使用一个而不是另一个?

I have looked at the API's for both components but am not too sure why you would use one over the other?

http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/index.html

http://download.oracle.com/docs/cd/E17802_01/j2ee/javaee/javaserverfaces/2.0/docs/pdldocs/facelets/h/outputLink.html

有人可以举例说明为什么您会选择其中之一吗?

Could somebody provide an example of why you would choose one over the other?

谢谢

推荐答案

  • 使用它的 value 属性作为链接文本和它的 outcome 属性来生成链接到的 URLJSF 导航规则.这使得它对应用程序内部链接很有用.此外,此组件仅在 JSF 2.0 上引入
  • 使用 value 属性直接作为链接到的 URL 和标签的内容作为链接文本.这意味着该组件不能与导航规则一起使用,但它可以用于直接和外部链接.它从 JSF 1.1 开始就已经存在.
    • <h:link> uses its value attribute as the link text and its outcome attribute to generate the linked-to URL via JSF navigation rules. This makes it useful for application-internal links. Also, this component was introduced only on JSF 2.0
    • <h:outputLink> uses the value attribute directly as linked-to URL and the content of the tag as link text. This means the component cannot be used with navigation rules, but it can be used for direct and external links. It has been around since JSF 1.1.
    • 这篇关于h:link 和 h:outputLink 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆