"This link is deactivated because it is not embedded in the JSF form."

When I use the following command link:

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

And the following navigation rule in 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> 

Then I get the following message about the faces of the development phase:

This link is disabled because it is not embedded in the JSF form.

How is this caused and how can I solve it?

+7
source share
2 answers

<h:commandLink> starts a POST request. You need to embed it in <h:form> .

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

Since you already use JSF 2.0, you can also just use <h:link> instead, which launches a GET request that does not require a form, and thus is much better for bookmarking and SEO. You can also get rid of the whole <navigation-rule> , since JSF 2.0 uses hidden navigation.

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

It will implicitly go to student.xhtml .

Make sure you read the JSF 2.0 tutorials, not the ones that target JSF 1.x. JSF 2.0 has added many new tags and features.

See also:

+10
source

You should have <h:form> packaging links.

+1
source

All Articles