需要复合成分= QUOT;真"不被尊重 [英] Composite component required="true" not respected
问题描述
在复合材料:界面我已经定义的属性是这样的:
In the composite:interface I have defined an attribute like this:
<composite:attribute name="myAttribute" required="true"/>
现在,当我用我这样的复合成分,没有定义任何属性:
Now when I use my composite component like this, without defining any attributes:
<myTag:myCC/>
我预计会出现错误。它没有。我能怎么可能会丢失?
I would expect an error to occur. It doesn't. What could I possibly be missing?
推荐答案
这将只有当你的JSF项目阶段被设置为发展发生
在<$ C $如下C>的web.xml :
It will only occur if your JSF project stage is set to Development
as follows in web.xml
:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
默认为生产
。如果你开始看到其他几个错误/相关的警告,以发展错误设置上述背景下参数后,请不要感到惊讶。
It defaults to Production
. Don't be surprised if you start to see several other errors/warnings related to "development mistakes" after setting the above context parameter.
在特定的情况下,你应该当你省略了必要的属性打开页面这样的事情中得到一个异常:
In your specific case you should get an exception during opening the page something like this when you omit the required attribute:
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)
...
这篇关于需要复合成分= QUOT;真&QUOT;不被尊重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!