try this:
<s:if test="hasErrors()">
<sj:dialog title="error message">
<s:actionerror/>
</sj:dialog>
</s:if>
Question
I have a form open in Struts2 jquery dialog box. When users submit this form, i want to show the Server Side error message (eg. Username exist,Please choose another) on this same open dialoguebox itself .
How can i do this? Any hint or suggestion! Please share.
index.jsp (on click of a button the below form will open)
`<s:actionerror/>
<s:form action="testError" id="form3" theme="simple"/>
<s:textfield name="quantity" value="1""/>
<s:form>
<sj:submit formId="form3" value="true"/>`
Action.java
public String execute()
{
addActionError("Error message is blah blah");
return ERROR;
}
Struts.xml
<action name="testError" class="com.Action">
<result name="error">index.jsp</result>
</action>
Solution
try this:
<s:if test="hasErrors()">
<sj:dialog title="error message">
<s:actionerror/>
</sj:dialog>
</s:if>