我有条纹:链接标记在与事件属性一个jsp:

<stripes:link href="${actionBean.context.currentStage.stripesForwardAction}"  addSourcePage="true" event="showTab2Link">

此触发验证对嵌套属性触发:

    @ValidateNestedProperties({
    @Validate(field="county", required=true, minlength=2, maxlength=2, mask="\\d\\d"),
    @Validate(field="parish", required=true, minlength=3, maxlength=3, mask="\\d\\d\\d"),
    @Validate(field="holding", required=true, minlength=4, maxlength=4, mask="\\d\\d\\d\\d")
}) 

然而,这将被罚款如果实际值是验证不存在,但它们是在HTML中存在和调试bean时。 为什么会产生条纹:链接触发这个结果 如果我将其改变为条纹:提交那么它是细

感谢,

戴夫

有帮助吗?

解决方案

它被触发的原因是因为条纹:提交必须在表单中的字段,所以在提交表单时,这些字段被发送到服务器。与链接,除非你加他们为链接参数你没有得到任何领域。

可以修复的两种方式这一个,这取决于:

你要出现在绿豆这些领域的链接被点击的时候?那么你就需要来用PARAMS的链接,这样他们就会被添加GET查询字符串风格:

<stripes:link href="${actionBean.context.currentStage.stripesForwardAction}"  addSourcePage="true" event="showTab2Link">
<stripes:param name="county" value="${actionBean.county}" />
<stripes:param name="parish" value="${actionBean.parish}" />
<stripes:param name="holding" value="${actionBean.holding}" />
link text
</stripes:link>

在另一方面,如果你不需要他们在bean针对该事件,你可以告诉你@ValidateNestedProperties忽略事件:

@ValidateNestedProperties({
    @Validate(field="county", on="!showTab2Link", required=true, minlength=2, maxlength=2, mask="\\d\\d"),
    @Validate(field="parish", on="!showTab2Link", required=true, minlength=3, maxlength=3, mask="\\d\\d\\d"),
    @Validate(field="holding", on="!showTab2Link", required=true, minlength=4, maxlength=4, mask="\\d\\d\\d\\d")
}) 

然后验证将不会对事件showTab2Link除非它实际上供给运行。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top