jsf-2 – “此链接已停用,因为它未嵌入JSF表单中.”
发布时间:2020-12-25 05:34:18 所属栏目:资源 来源:网络整理
导读:当我使用以下命令链接时: 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.xhtm
当我使用以下命令链接时: <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> 然后我得到以下开发阶段面部消息:
这是怎么造成的,如何解决? 解决方法< 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? (编辑:站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |