Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How behaves f:view with many defined resource library contracts?

We're trying to use the <f:view contracts="xxx" /> feature from JSF 2.2, with many simultaneous contracts, as "contract1,contract2".

In our contract1, we have a file style1.css, and in our contract2, a style2.css. We include both in our views through <h:outputStylesheet /> tags.

If I only use contracts="contract1" in the view, JSF logs than style2.css is missing, which is logical.

If I use contracts="contract1,contract2", JSF imports both style1.css and style2.css, but with a faulty url (it uses &con=contract1 instead of &con=contract2 to get the resource).

Is it a bug? Is it normal? I can't find any documentation about the use of many simultaneous contracts.

like image 799
Xavier Portebois Avatar asked Mar 11 '14 15:03

Xavier Portebois


1 Answers

That's normal behaviour, as I've found in the Apress Pro JSF and HTML 5 text book. An excerpt:

It's possible to map multiple contracts to a single mapping. In that case, it will go through each contract sequentially to look for the required templates. Once a template has been found, it will stop processing other templates.

As to why it's allowed, if all it's going to do is pick the first suitable option, I'm with you on the fact that it may be pointless after all.

Reference:

  • Apress Pro JSF and HTML 5
like image 186
kolossus Avatar answered Nov 18 '22 09:11

kolossus