Struts1.3.5のlogicタグライブラリ
制御文などを規定したタグリブ郡。
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
logic
logic:present/notPresent
存在判定を行う。
<!-- beanが存在しているか判定 --><logic:present name="bean">beanはあります</logic:present> <!-- beanが存在していないか判定 --><logic:notPresent name="bean">beanはありません</logic:notPresent> <!-- beanのnameプロパティが存在しているか判定 --><logic:present name="TestForm" property="name">nameはあるね</logic:present>
logic:messagesPresent
Form内にメッセージがある場合に、タグ内の処理を実行する。成功メッセージの表示に使える。message属性がtureならばメッセージ。
falseならばエラーメッセージの有無をチェックしてくれる。message属性を指定しなければ両方のメッセージをチェックしてくれる。
<logic:messagesPresent message="true"> <html:messages id="msg" message="true" header="success.header" footer="success.footer"> <li><bean:write name="msg" ignore="true"/></li> </html:messages></logic:messagesPresent>
logic:equal/notEqual
値が等しいかどうかを判定。
<bean:define id="list" name="TestForm" property="voList" type="java.util.List" /><bean:size id="listSize" name="list" /> <logic:equal name="listSize" value="0"> <div class="nodata">データは0件です。</div></logic:equal><logic:notEqual name="listSize" value="0">・・・データを表示</logic:notEqual>
logic:iterate
ループ用。指定したコレクションがNullの場合はエラーとなる。
<!-- beanからコレクションを与える場合 --><logic:iterate id="user" name="TestForm" property="displayList"> <bean:write name="user" property="name" /></logic:iterate>
<!-- JSPから与える場合 --><% ArrayList list = new ArrayList(); list.add("グッド"); list.add("ルッキング");%><logic:iterate id="str" collection="<%=list%>"> <bean:write name="str" /><br></logic:iterate>
logic:empty
null判定。Collectionの場合はサイズ0の判定を行う。
<!-- nullの場合 --><logic:empty name="UserListForm" property="userVONullList"> userVONullListはnullです。</logic:empty> <!-- sizeが0の場合 --><logic:empty name="UserListForm" property="userVOSize0List"> userVONullListはサイズ0です。</logic:empty>
I'm a software engineer who like travel to island in Japanese. Recently I am enjoying agile manager, coach, product owner for my work. The person grows like that.











