struts2验证的时候 为什么类型转换错误的时候不提示呢? 
我用了struts的标签库。但是我自己重写的validate()方法中的错误提示信息却都显示了。 
如果类型转换错误,应该框架自己显示啊?正常的应该提示Invalid field value for field“”? 
代码: 
public class RegisterAction extends ActionSupport { String username; 
String password; 
String repassword; 
int age; 
Date startDate; 
Date endDate; 
public String getUsername() { 
return username; 

public void setUsername(String username) { 
this.username = username; 

public String getPassword() { 
return password; 

public void setPassword(String password) { 
this.password = password; 

public String getRepassword() { 
return repassword; 

public void setRepassword(String repassword) { 
this.repassword = repassword; 

public int getAge() { 
return age; 

public void setAge(int age) { 
this.age = age; 

public Date getStartDate() { 
return startDate; 

public void setStartDate(Date startDate) { 
this.startDate = startDate; 

public Date getEndDate() { 
return endDate; 

public void setEndDate(Date endDate) { 
this.endDate = endDate; 
} public String execute() throws Exception { 
System.out.println("RegisterAction.execute()"); 
return this.SUCCESS; 
} public void validate() { 
System.out.println("RegisterAction.validate()"); if(null == username || username.trim().length() <5 || username.trim().length()>12) { 
this.addFieldError("username", "用户名的长度应为5-12"); 
} if(null == password || password.trim().length() <5) { 
this.addFieldError("password", "密码的长度应为5-12"); 
}else if(null == repassword || repassword.trim().length() <5) { 
this.addFieldError("repassword", "确认密码的长度应为5-12"); 
}else if(!password.equals(repassword)) { 
this.addFieldError("password", "两次输入的密码不一致!"); 

if(age == 0) { 
this.addFieldError("age","年龄不能为空"); 

if(age < 0 ||age >160) { 
this.addFieldError("age","您所输入的年龄不对"); 

if(startDate != null && endDate != null){ 
Calendar start = Calendar.getInstance(); 
start.setTime(startDate); Calendar end = Calendar.getInstance(); 
end.setTime(endDate); if(!start.before(end)) { 
this.addFieldError("startDate", "毕业日期应该在入学日期之前!"); 

} } 

========================================================================== 
jsp中用的是标签库: <s:form action="register"> 
<s:textfield name="username" label="username"> </s:textfield> 
<s:textfield name="password" label="password"> </s:textfield> 
<s:textfield name="repassword" label="password2"> </s:textfield> 
<s:textfield name="age" label="age"> </s:textfield> 
<s:textfield name="startDate" label="startDate"> </s:textfield> 
<s:textfield name="endDate" label="endDate"> </s:textfield> 
<s:submit label="submit"> </s:submit> 
</s:form> ================================================================================== 
配置文件: 
<action name="register" class="com.cfd.struts2.RegisterAction"> 
<result name="success">/success.jsp </result> 
<result name="input">/register_taglib.jsp </result> 
</action> 
===================================== 
为什么自己的错误都能显示,但是类型转换的错误就是不出呢? 而且明显已经类型转换错误了,居然还能提交!!!