You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2013/07/12 08:37:50 UTC
[jira] [Updated] (WW-3175) Ajax Validation does not effective when
Action implements Model Driven,and other Issues below
[ https://issues.apache.org/jira/browse/WW-3175?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart updated WW-3175:
------------------------------
Description:
Ajax Validation does not be effective when Action implements Model Driven
but for the action not implements model driven, it works
Validator:
{code:xml}
<validators>
<field name="model.account">
<field-validator type="requiredstring">
<message >Account is required!!!</message>
</field-validator>
</field>
</validators>
{code}
Action:
{code:java}
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;
}
}
{code}
JSP:
{code:xml}
<%@ 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>
{code}
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
{code:xml}
<s:file name="userDetail" key="input.detail" />
{code}
Issue3:
When i put custom type convention in Model Driven action,
and use the beanClassname-conversion.properties
e.g. UserInfo-conversion.properties
and name is a property of UserInfo Class and have a custom type convertor
{noformat}
name=struts2.demo.UserNameConverter
{noformat}
When i use ajax validation and config in Validation XML like this:
{code:xml}
<field name="model.name">
<field-validator type="conversion">
<message key="name.required" />
</field-validator>
</field>
{code}
When i click submit button, it directly show alert box : Object Error
Issue4:
if Datetimepicker Tag set "required" Validation Rule in XML,
When i click submit button, it directly show alert box : Object Error
{code:xml}
<field name="model.birthday">
<field-validator type="required">
<message key="birthday.required" />
</field-validator>
<field-validator type="date">
<param name="min">1888-01-01</param>
<param name="max">2008-01-01</param>
<message key="birthday.error" />
</field-validator>
</field>
{code}
was:
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:
When i put custom type convention in Model Driven action,
and use the beanClassname-conversion.properties
e.g. UserInfo-conversion.properties
and name is a property of UserInfo Class and have a custom type convertor
name=struts2.demo.UserNameConverter
When i use ajax validation and config in Validation XML like this:
<field name="model.name">
<field-validator type="conversion">
<message key="name.required" />
</field-validator>
</field>
When i click submit button, it directly show alert box : Object Error
Issue4:
if Datetimepicker Tag set "required" Validation Rule in XML,
When i click submit button, it directly show alert box : Object Error
<field name="model.birthday">
<field-validator type="required">
<message key="birthday.required" />
</field-validator>
<field-validator type="date">
<param name="min">1888-01-01</param>
<param name="max">2008-01-01</param>
<message key="birthday.error" />
</field-validator>
</field>
> Ajax Validation does not effective when Action implements Model Driven,and other Issues below
> ---------------------------------------------------------------------------------------------
>
> Key: WW-3175
> URL: https://issues.apache.org/jira/browse/WW-3175
> Project: Struts 2
> Issue Type: Bug
> Components: XML Validators
> Affects Versions: 2.1.6
> Environment: Tomcat
> Reporter: Yuan
> Priority: Critical
> Fix For: 2.3.16
>
>
> Ajax Validation does not be effective when Action implements Model Driven
> but for the action not implements model driven, it works
> Validator:
> {code:xml}
> <validators>
> <field name="model.account">
> <field-validator type="requiredstring">
> <message >Account is required!!!</message>
> </field-validator>
> </field>
> </validators>
> {code}
> Action:
> {code:java}
> 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;
> }
>
> }
> {code}
> JSP:
> {code:xml}
> <%@ 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>
> {code}
> 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
> {code:xml}
> <s:file name="userDetail" key="input.detail" />
> {code}
> Issue3:
> When i put custom type convention in Model Driven action,
> and use the beanClassname-conversion.properties
> e.g. UserInfo-conversion.properties
> and name is a property of UserInfo Class and have a custom type convertor
> {noformat}
> name=struts2.demo.UserNameConverter
> {noformat}
> When i use ajax validation and config in Validation XML like this:
> {code:xml}
> <field name="model.name">
> <field-validator type="conversion">
> <message key="name.required" />
> </field-validator>
> </field>
> {code}
> When i click submit button, it directly show alert box : Object Error
> Issue4:
> if Datetimepicker Tag set "required" Validation Rule in XML,
> When i click submit button, it directly show alert box : Object Error
> {code:xml}
> <field name="model.birthday">
> <field-validator type="required">
> <message key="birthday.required" />
> </field-validator>
> <field-validator type="date">
>
> <param name="min">1888-01-01</param>
> <param name="max">2008-01-01</param>
> <message key="birthday.error" />
> </field-validator>
> </field>
> {code}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira