加入收藏 | 设为首页 | 会员中心 | 我要投稿 济南站长网 (https://www.0531zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 资源网站 > 资源 > 正文

jsf-2 – “此链接已停用,因为它未嵌入JSF表单中.”

发布时间:2020-12-25 04:20:42 所属栏目:资源 来源:网络整理
导读:当我使用以下命令链接时: h:commandLink action="student" value="students" / 以及faces-config.xml中的以下导航规则: navigation-rule from-view-id/home.xhtml/from-view-id navigation-case from-outcomestudent/from-outcome to-view-id/student.xh

当我使用以下命令链接时:

<h:commandLink action="student" value="students" />

以及faces-config.xml中的以下导航规则:

<navigation-rule>
  <from-view-id>/home.xhtml</from-view-id>
  <navigation-case>
    <from-outcome>student</from-outcome>
    <to-view-id>/student.xhtml</to-view-id>
  </navigation-case>
</navigation-rule>

然后我得到以下开发阶段面部消息:

This link is deactivated,because it is not embedded in a JSF form.

这是怎么造成的,如何解决?

解决方法

< h:commandLink>触发POST请求.您需要将其嵌入< h:form>中.
<h:form>
    <h:commandLink action="student" value="students" />
</h:form>

由于您已经使用JSF 2.0,因此您也可以使用< h:link>相反,它会激发一个不需要表格的GET请求,因此对于书签和搜索引擎优化更好.你也可以摆脱整个< navigation-rule>因为JSF 2.0使用隐式导航.

<h:link value="students" outcome="student" />

它将隐式转到student.xhtml.

确保您正在阅读JSF 2.0教程,而不是针对JSF 1.x的教程.在JSF 2.0中添加了许多新标签和功能.

也可以看看:

> When should I use h:outputLink instead of h:commandLink?
> We don’t need stinkin’ faces-config

(编辑:济南站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读