Struts2 如何将验证错误显示为列表

Struts2 如何将验证错误显示为列表,struts2,Struts2,我有一个简单的登录表单,jsp文件中有以下代码: <s:form action="conexion" validate="true" theme="xhtml" target="formError"> <s:textfield name="username" key="profile.rut" /> <s:password name="password" key="profile.password" />

我有一个简单的登录表单,jsp文件中有以下代码:

     <s:form
        action="conexion" validate="true" theme="xhtml" target="formError">
        <s:textfield name="username" key="profile.rut" />
        <s:password name="password" key="profile.password" />
        <s:submit id="boton_ingreso"/>
    </s:form>

渲染时,将按以下方式渲染:

<form onreset="clearErrorMessages(this);clearErrorLabels(this);" method="post" target="formError" action="/AgendaPlus/conexion.action" onsubmit="return validateForm_conexion();" name="conexion" id="conexion">
<table class="wwFormTable">
<tbody><tr>
<td class="tdLabel"><label class="label" for="conexion_username">RUT:</label></td>
<td><input type="text" id="conexion_username" value="" name="username"></td>
</tr>

<tr>
<td class="tdLabel"><label class="label" for="conexion_password">Contraseña:</label></td>
<td><input type="password" id="conexion_password" name="password"></td>
</tr>

<tr>
<td colspan="2"><div align="right"><input type="submit" value="Submit" id="boton_ingreso" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false">
</div></td>
</tr>

</tbody></table></form>

车辙:
相反的尼娜:
这样,当发生错误时,错误将显示在每个字段上方,错误标记为
,因为它是一个表,所以我无法将其设置为移动到其他位置。我尝试使用
标记的target属性,但没有成功。

请参阅:


你知道还有其他主题,你可以创造自己的,对吗

例如,
“simple”
主题不会呈现任何表或错误

target
属性似乎是错误报告的一个奇怪用法

<s:fielderror />