0
我有一個電話號碼組件,我試圖驗證,但由於某種原因,我無法獲取條形碼驗證錯誤,以顯示在表單上的電話號碼字段。如果我在窗體的以外顯示標籤,則會顯示錯誤,但它們不會附加到該字段。沒有出現在表單中的文本字段上的條紋錯誤
<e:declare-component name="PhoneNumberForm" css="true" js="true">
<stripes:errors /> <%-- This tag displays errors --%>
<e:sslform id="submit-phone-number-form" action="${componentContext.action}">
<div class="phone-wrapper">
<stripes:text name="phoneNumber" id="phoneNumber" class="TextInput" />
<stripes:errors field="phoneNumber" /> <%-- This tag DOES NOT display errors --%>
</div>
...
</e:sslform>
</e:declare-component>
表單提交給擴展ActionBean並實現ValidationErrorHandler的java類。我發現驗證方法被調用,並且驗證錯誤不是空的(它包含電話號碼驗證錯誤)。
需要注意的事項:當我更改表單以提交給beanclass而不是action時,錯誤字段顯示正確;然而,這不是我的解決方案,因爲這個組件在代碼庫的其他地方使用。 beanclass和action之間有什麼不同?
任何想法爲什麼?謝謝!