java seasar2 jsp EL 式 Mapのデータ表示 

seaser2使用している場合です。
//フォーム
public class TestForm {

 public Map<String, String> testMap = null;

}

//アクションでのFormの定義

 @ActionForm
 @Resource
 public TestForm testForm = null;
//アクションでMap詰める
Map<String, String> testMap = new LinkedHashMap<String, String>();
for(int i = 0; i <= 23; i++) {
 testMap.put(String.valueOf(i), String.valueOf(i*10));
}
testForm.testMap = testMap; 
//jsp
<c:forEach var=”testMap”  items=”${testForm.testMap}”>
 <bean:define id=”key”  name=”testMap” property=”key” ></bean:define>
 <bean:define id=”value”  name=”testMap” property=”value” ></bean:define>
 <c:out value=”${f:h(key)}”></c:out>
 <c:out value=”${f:h(value)}”></c:out>
</c:forEach>

mysql 日付整形 date_format

日付の整形を行ないたい時に、DBそれぞれで関数・書式がことなるので

順次メモする。

DATE_FORMAT(date,format)

%Y/%m/%d %H:%i:%s

%Y 年・数字・4桁、%m 月・数字(01-12)、%d 日・数字(01-31)
 

 

%H 時間(00-23)、%i 分・数字(00-59)、%s 秒(00-59)