首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

Struts 二 Hibernate Validation Tutorial

2013-03-06 
Struts 2 Hibernate Validation Tutorial?By default the?defaultStackHibernate?interceptor stack will

Struts 2 Hibernate Validation Tutorial

?

By default the?defaultStackHibernate?interceptor stack will be used. In the?addUser?action we use this inteceptor stack since we need validation capability and during the?listUser?action action we use?basicStackHibernate?because we don't need validation capability this time.

In the?register.jsp?page instead of using the?name?attribute to specify the property value we use the?key?attribute. This is need for the default validation messages to be generated.

The validation messge for the fields?User Name, Password?and?About You?has the field label before the default validation error message. This is because we specified the key values in theUserAction.properties?file. If you only want the validation message to be displayed then don't specify an entry for that field in the properties file. Here the gender and the country fields have only the customized error messages and not the field labels.

Everything else remains the same as the previous example (?Struts 2 Hibernate Integration?).

You can download and try this example here.

热点排行