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

查看:206
本文介绍了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?

谢谢

推荐答案

  • <h:link>使用其value属性作为链接文本,并使用其outcome属性通过JSF导航规则生成链接到的URL.这对于应用程序内部链接很有用.另外,此组件仅在JSF 2.0上引入
  • <h:outputLink>直接将value属性用作链接的URL,并将标记的 content 用作链接文本.这意味着该组件不能与导航规则一起使用,但是可以用于直接和外部链接.自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天全站免登陆