我的代码中有一个Spring表单输入标签,看起来像这样
<form:input path="${field}" id="${id}" placeholder='${placeholder}' type="${type}" cssClass='${inputCssClass} ${alert}' cssStyle="${cssStyle}"
title="${tooltipText}" data-validation="${validation}"
data-validation-length="${validationLength}"
data-validation-format="${validationFormat}"
data-validation-confirm="${validationConfirm}"
data-validation-regexp="${validationRegexp}"
data-validation-allowing="${validationAllowing}"
data-password-validation="${dataPasswordValidation}"
data-validation-error-msg="${dataValidationErrorMsg}"
data-validation-error-msg-required="${dataValidationErrorMsgRequired}"
data-validation-error-msg-length="${dataValidationErrorMsgLength}"
data-validation-error-msg-number="${dataValidationErrorMsgNumber}"
data-validation-error-msg-date="${dataValidationErrorMsgDate}"
data-validation-error-msg-email="${dataValidationErrorMsgEmail}"
data-validation-error-msg-alphanumeric="${dataValidationErrorMsgAlphanumeric}"
data-validation-error-msg-confirmation="${dataValidationErrorMsgConfirm}"
data-validation-require-leading-zero="${dataLeadingZero}"
data-validation-optional="${dataOptional}"
autocomplete="${autocomplete}"
readonly="${isReadonly}"
/>
当该字段为空时,我应该隐藏整个标签。我经历了Spring's documentation for such tag,但没有找到合适的解决方案的运气。我尝试使用cssErrorClass
属性设置具有隐藏显示的类,但是它不会将该类应用于空字段。