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.


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
  • 链接地址: http://www.djcxy.com/p/78030.html

    上一篇: 如何打印当前的bash提示符?

    下一篇: f的行为如何:使用许多已定义的资源库合同进行查看?