ファイル選択フィールドを持つ典型的な struts2 フォームがあります。
<s:form action="%{#parameters.myAction}" namespace="/" method="post" name="myForm" enctype="multipart/form-data" focusElement="storeBrandNameId">
<s:textfield name="storeBrandName" id="storeBrandNameId" size="40" maxlength="50" required="true" key="storeBrandName-label" tooltip="%{getText('storeBrandName-label-help')}" />
<s:file name="storeImage" key="storeImage-label"/>
/* ... Other fields removed for clarity ... */
<s:submit key="submit" />
</s:form>
(XML 検証を使用して) 検証エラーが発生した場合を除いて、フォームは正常に機能します。その場合、選択したファイル (存在する場合) を除いて、すべてのフィールド値が保持されます。
選択したファイルが検証エラーでクリアされるのはなぜですか? それは私の側のバグですか?struts2の制限?または典型的なブラウザの制限?回避策はありますか?