JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Web Framework » Struts  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
作者 Re:form 的validate可以依照不同情況作不同的validate嗎 [Re:shasun]

發文: 6
積分: 4
於 2006-10-27 20:24 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ValidatorActionForm 可以解你的問題,請參


In addition to the two standard options for creating Form Beans, Validator provides an advanced feature for tying multiple validation definitions to one Form Bean definition. When you use validatorForm- or DynaValidatorForm-based Form Beans, Validator uses the logical name for the Form Bean from the struts-config.xml file to map the Form Bean to validation definitions in the validation.xml file. This mechanism is great in most cases, but in some scenarios, Form Beans are shared among multiple actions. One action may use all of the Form Bean's fields, and another action may use only a subset of the fields. Because validation definitions are tied to the Form Bean, the action that uses only a subset of the fields has no way of bypassing validations for the unused fields. When the Form Bean is validated, it generates error messages for the unused fields, because Validator has no way of knowing not to validate the unused fields; it simply sees them as missing or invalid.

To solve this problem, Validator provides two additional ActionForm subclasses that allow you to tie validations to actions instead of to Form Beans. That way you can specify which validations to apply to the Form Bean based on which action is using the Form Bean. For concrete Form Beans, you subclass org.apache.struts.validator.ValidatorActionForm

reply to postreply to post
人氣 標題 作者 字數 發文時間
3635 form 的validate可以依照不同情況作不同的validate嗎 shasun 135 2006-09-07 10:15
2991 Re:form 的validate可以依照不同情況作不同的validate嗎 shasun 93 2006-09-25 11:18
2910 Re:form 的validate可以依照不同情況作不同的validate嗎 chihiro33 111 2006-09-25 11:55
3015 Re:form 的validate可以依照不同情況作不同的validate嗎 shasun 180 2006-09-26 09:28
3040 Re:form 的validate可以依照不同情況作不同的validate嗎 brando 1468 2006-10-27 20:24
» JWorld@TW »  Web Framework » Struts

reply to postflat modego to previous topicgo to next topic
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8