struts2的簡單校正筆記

來源:互聯網
上載者:User

標籤:使用   檔案   cti   io   type   res   

1.校正檔案名稱的寫法:Action name-validator.xml
2.校正檔案應該放在action 對應的包裡面
3.校正檔案的寫法。
<validators>
<!-- 設定要校正的參數-->
<field name="param name">
<field-validator type="requiredstring">
<!--設定參數trim為true-->
<param name="trim">true</param>
<!--設定錯誤訊息-->
<message></message>
</field-validator>
</field>
</validators>

4.常用的校正參數與類型
type

url url校正
email 郵箱校正
requiredstring 必填字元
regex 正直運算式
date
int
...
param

max int
min int
expression 使用正直運算式
trim bool
...

5.使用校正的頁面必須經過struts2的核心filter。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.