pgs*_*rom 4 jsf attributes required composite-component jsf-2
在composite:interface中我定义了一个这样的属性:
<composite:attribute name="myAttribute" required="true"/>
Run Code Online (Sandbox Code Playgroud)
现在当我像这样使用我的复合组件时,没有定义任何属性:
<myTag:myCC/>
Run Code Online (Sandbox Code Playgroud)
我希望会发生错误.它没有.我可能会错过什么?
只有在您的JSF项目阶段设置Development如下时才会出现web.xml:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
它默认为Production.如果在设置上述上下文参数后开始看到与"开发错误"相关的其他几个错误/警告,请不要感到惊讶.
在您的特定情况下,当您省略所需属性时,在打开页面时会出现异常:
javax.faces.view.facelets.TagException: /test.xhtml @22,19 <my:composite> The following attribute(s) are required, but no values have been supplied for them: foo.
at com.sun.faces.facelets.tag.composite.InterfaceHandler.validateComponent(InterfaceHandler.java:232)
at com.sun.faces.facelets.tag.composite.InterfaceHandler.apply(InterfaceHandler.java:125)
at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1051 次 |
| 最近记录: |