atitit.提升开发效率---MDA 软件开发方式的革命(4)----编辑表单建模
2. 指定显示模板 @BeanEditForm(tmplt="c:/edit.html") 1
3. 配置属性的@Property(lable=”xxx”)显示 2
4. 配置属性的显示控件方式@DataType(value=DataTypeConstants.select,datasource="c:/cate.htm") 2
6. 属性排序@BeanEditForm( reorder="aa,bb") 2
7. 客户端验证 @Validate("required")@Validate("min=18,max=99,msg=’重新输入’") 2
8. 数据转换@com.attilax.anno.Converter(TimeConverterO7.class) 3
1. 建模语言的选型anno+html...不是uml
因为只十个数据建模,马包括流程建模
作者:: 老哇的爪子 Attilax 艾龙, EMAIL:1466519819@qq.com
转载请注明来源: http://blog.csdn.net/attilax
2. 指定显示模板 @BeanEditForm(tmplt="c:/edit.html")
public class GvMaterial
3. 配置属性的@Property(lable=”xxx”)显示
4. 配置属性的显示控件方式@DataType(value=DataTypeConstants.select,datasource="c:/cate.htm")
DataTypeConstants.time
DataTypeConstants.datetime
DataTypeConstants.file
DataTypeConstants.select
@DataType(value=DataTypeConstants.select,datasource="c:/cate.htm")
5. 配置id不显示@NonVisual
6. 属性排序@BeanEditForm( reorder="aa,bb")
7. 客户端验证 @Validate("required")@Validate("min=18,max=99,msg=’重新输入’")
Validator |
Constraint Type |
Description |
Example |
– |
Ensures that the given input looks like a valid e-mail address |
<t:textfield value="email" validate="email" /> |
|
max |
long |
Enforces a maximum integer value |
<t:textfield value="age" validate="max=120,min=0" /> |
maxLength |
int |
Makes sure that a string value has a maximum length |
<t:textfield value="zip" validate="maxlength=7" /> |
min |
long |
Enforces a minimum integer value |
<t:textfield value="age" validate="max=120,min=0" /> |
minLength |
int |
Makes sure that a string value has a minimum length |
<t:textfield value="somefield" validate="minlength=1" /> |
none |
– |
Does nothing (used to override a @Validate annotation) |
<t:textfield value="somefield" validate="none" /> |
regexp |
pattern |
Makes sure that a string value conforms to a given pattern |
<t:textfield value="letterfield" validate="regexp=^[A-Za-z]+$" /> |
required |
– |
Makes sure that a string value is not null and not the empty string |
<t:textfield value="name" validate="required" /> |
8. 数据转换@com.attilax.anno.Converter(TimeConverterO7.class)
9. 数据转换组件TimeConverterO7
class TimeConverterO7 implements org.apache.commons.beanutils.Converter
public Object convert(Class arg0, Object arg1) {
// attilax 老哇的爪子 5:24:02 AM Jul 19, 2014
try {
return DateUtil.toTimeStamp(arg1, true);
} catch (ParseException e) {
// attilax 老哇的爪子 5:28:07 AM Jul 19, 2014
core.log(e);
return 0;
}
}
10. 参考
Forms and Validation -- Apache Tapestry.htm