I'm currently having a problem with my setup. I have this action tag in my JSP
<s:action name="doLogin" executeResult="true"></s:action>
and below is the corresponding struts.xml entry
<action name="doLogin" class="siteLoginAction">
<result name="input">login</result>
<result name="success">home</result>
</action>
The jsp is just a login div (form, textfield, label).
Now the problem is that when I'm testing the validate function
@Override
public void validate() {
String username = siteUser.getSiteUserUsername();
String password = siteUser.getSiteUserPassword();
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) {
addFieldError("siteUser.siteUserUsername", "Invalid login");
} else if (!siteUserService.checkLoginExists(username, password, getBlogSiteUrl())) {
addFieldError("siteUser.siteUserPassword", "Invalid login");
}
}
As you can see it works,
but it will not go away. The error message will stay there everytime I visit that page.
Is this because of the singleton default model of the Struts2 action? I have tried @Scope("prototype") but if I use it it doesn't display the error at all