標籤:des style blog http color 資料
atitit.提升開發效率---MDA 軟體開發方式的革命(4)----編輯表單建模
1. 建模語言的選型anno+html...不是uml 1
2. 指定顯示模板 @BeanEditForm(tmplt="c:/edit.html") 1
3. 配置屬性的@Property(lable=”xxx”)顯示 2
4. 配置屬性的顯示控制項方式@DataType(value=DataTypeConstants.select,datasource="c:/cate.htm") 2
5. 配置id不顯示@NonVisual 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
9. 資料轉換組件TimeConverterO7 4
10. 參考 4
1. 建模語言的選型anno+html...不是uml
因為只十個資料建模,馬包括流程建模
作者:: 老哇的爪子 Attilax 艾龍, EMAIL:[email protected]
轉載請註明來源: 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不顯示@NonVisual6. 屬性排序@BeanEditForm( reorder="aa,bb")7. 用戶端驗證 @Validate("required")@Validate("min=18,max=99,msg=’重新輸入’")
Validator |
Constraint Type |
Description |
Example |
email |
– |
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