Ajax Validation does not be effective when Action implements Model Driven
but for the action not implements model driven, it works
Validator:
<validators>
<field name="model.account">
<field-validator type="requiredstring">
<message >Account is required!!!</message>
</field-validator>
</field>
</validators>
Action:
public class TestAction extends ActionSupport implements ModelDriven
{
/**
* @return user
*/
public TestUser getUser()
{
return user;
}
/**
* @param 对user
*/
public void setUser(TestUser user)
{
this.user = user;
}
private TestUser user=new TestUser();
public String execute()
{
return "success";
}
/**
* @return
*/
public Object getModel()
{
// TODO Auto-generated method stub
return this.user;
}
}
JSP:
<%@ page language="java" contentType="text/html; charset=GBK"%>
<%...@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="/struts-dojo-tags" prefix="sx"%>
<html>
<head>
<title></title>
<sx:head debug="true" />
</head>
<body>
<s:form action="test.action" id="form" >
<s:url id="url" action="test.action"/>
<caption><h3>Login</h3></caption>
<s:textfield name="account" label="Account Info" />
<tr>
<sx:submit key="input.submit" validate="true" />
</tr>
</s:form>
<script type="text/javascript">
</script>
</body>
</html>
Issue1:When i click the button with blank input, it can show the validate
error message
but when I input some message, and click, it still show "required" error
message,
It seemed ajax validation is not effect ed for model driven
Issue2:
When i put File Upload control in jsp and use "required" validation rule,
the submit buttong can not be submited and show error in IE status bar
<s:file name="userDetail" key="input.detail" />
Issue3:
if Datetimepicker Tag set "required" Validation Rule in XML,
When i click submit button, it directly show alert box : Object Error
I have tested other tags,if the tag is assigned "required" validation
rule,it may cause the "Object Error" Javascript alert error in IE6
<field name="model.birthday">
<field-validator type="required">
<message key="birthday.required" />
</field-validator>
<field-validator type="date">
1888-01-01
2008-01-01
<message key="birthday.error" />
</field-validator>
</field>
--
View this message in context:
http://www.nabble.com/Struts-2.1.6%27s-bug--or-my-configuration-error--tp24437329p24437329.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]