struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yuan (JIRA)" <j...@apache.org>
Subject [jira] Created: (WW-3175) Ajax Validation does not effective when Action implements Model Driven,and other Issues below
Date Fri, 03 Jul 2009 02:59:59 GMT
Ajax Validation does not effective when Action implements Model Driven,and other Issues below
---------------------------------------------------------------------------------------------

                 Key: WW-3175
                 URL: https://issues.apache.org/struts/browse/WW-3175
             Project: Struts 2
          Issue Type: Bug
          Components: XML Validators
    Affects Versions: 2.1.6
         Environment: Tomcat
            Reporter: Yuan
            Priority: Critical


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>







-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message