Struts2入門 validate
validate method を用いる方式
利用方法
- Action Class に validate メソッドを書くと 自動で呼ばれる
- エラーがあった場合、"input"にforwardする
- validateを実行したくないクラスには @SkipValidation をつける
sample
validate method in action class
public void validate(){ addActionError("error msg"); addFieldError("name attribute", "error msg"); }
<s:actionerror />
Java 配列の検索
事前にsort しておけば、Arrays.binarySearchで検索できる
String[] strsr = {"a", "b", "c"}; String search = "c"; if ( Arrays.binarySearch(strsr, search) >= 1){ System.out.println("c is exists!"); } else { System.out.println("c is not exists"); }
Java 配列の定義
空の配列を生成
String[] arr = new String[10];
最初から値を入れる
String[] arr = {"a", "b", "c"}; String[] arr = new String[] {"a", "b", "c"};
定義のみ。(下記は同一意味)
int a[] int[] a
Apache mod cache
DB2 date型への変換
変換するときは、一度 char にしてから 変換する必要がある
date(char('2014-01-01'))
現在のディレクトリ配下の容量を確認する
find ./ -maxdepth 1 -type d | xargs du -chs