将验证器传递给自定义组件失败
我有一个带有验证器的简单 inputText:
<ice:inputText
id="test"
value="#{applicationBean.selectedApplication['name']}"
validator="defaultFieldValidator"
required="true"></ice:inputText>
<ice:message
styleClass="graValidationMessage graNotRequired"
for="test" />
您可能已经注意到我指定了一个验证器:defaultFieldValidator 并且一切正常。
我现在制作一个组件,它的作用类似于名为 inputText 的包装器: inputTextValidated:
<ice:inputText
id="#{id}#{required}"
value="#{bean[field]}"
rendered="#{rendered}"
styleClass="#{styleClass} #{not required ? 'graNotRequired':''}"
style="width: #{width};"
partialSubmit="#{partialSubmit}"
disabled="#{disabled}"
required="#{required}"
validator="#{validatorClass}">
</ice:inputText>
如果我现在尝试调用此组件(使用与现在通过参数传递的相同的验证器开始):
<gra:inputTextValidated
id="inputText"
bean="#{applicationBean.selectedApplication}"
field="#{fieldValue}"
validatorClass="defaultFieldValidator"
renderLabel="false"
required="true"
disabled="false"
width="90%"
height="#{secondTabComponentsHeight}">
</gra:inputTextValidated>
如果失败并出现以下错误:
Identity 'validatorClass' does not reference a MethodExpression instance, returned type: java.lang.String
所以问题是将验证器名称发送到我的自定义组件时。
您看到解决方法了吗?
谢谢。
I have a simple inputText with a validator:
<ice:inputText
id="test"
value="#{applicationBean.selectedApplication['name']}"
validator="defaultFieldValidator"
required="true"></ice:inputText>
<ice:message
styleClass="graValidationMessage graNotRequired"
for="test" />
You may have noticed that I specified a validator: defaultFieldValidator and all works fine.
I now make a component to act like a wrapper for the inputText named: inputTextValidated:
<ice:inputText
id="#{id}#{required}"
value="#{bean[field]}"
rendered="#{rendered}"
styleClass="#{styleClass} #{not required ? 'graNotRequired':''}"
style="width: #{width};"
partialSubmit="#{partialSubmit}"
disabled="#{disabled}"
required="#{required}"
validator="#{validatorClass}">
</ice:inputText>
If I try now to call this component (with the same validator for beginning passed now through a parameter):
<gra:inputTextValidated
id="inputText"
bean="#{applicationBean.selectedApplication}"
field="#{fieldValue}"
validatorClass="defaultFieldValidator"
renderLabel="false"
required="true"
disabled="false"
width="90%"
height="#{secondTabComponentsHeight}">
</gra:inputTextValidated>
if fails with the following error:
Identity 'validatorClass' does not reference a MethodExpression instance, returned type: java.lang.String
So the problem is when sending the validator name to my custom component.
Do you see a work-around?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终
在我的 inputText 组件中使用
I've ended up using
inside my inputText component