JSP カスタムタグのライブラリ


例:viewitem タグ
このコードは、ビューのエントリが formlink タグを通してリンクする theForm.jsp に表を作成します。

<%@ taglib uri="WEB-INF/lib/domtags.tld" prefix="domino" %>
<html>
<body>
<domino:form name="myForm" schema="Article" dbname="myDatabase.nsf">
 <table>
   <tr>
     <td>Author:<td><domino:item name="Author"/></tr>
   <tr>
     <td>Title:<td><domino:input name="Title" size="80"/></tr>
   <tr>
     <td colspan=2><domino:richtext width="100%" name="Body"/></tr>
   <tr>
     <td colspan=2><domino:editdoc/><domino:savedoc/></tr>
 </table>
</domino:form>
</body>
</html>

次のコードは theView.jsp という JSP で使用され、theForm.jsp 上にある表の [Title] 列への、[Title] ビューのエントリのホットリンクを作成します。

<%@ taglib uri="WEB-INF/lib/domtags.tld" prefix="domino" %>
<html>
<body>
<domino:view dbname="myDatabase.nsf" viewname="All">
 <table border=1>
   <tr><th>Title<th>Date<th>Author</tr>
   <domino:viewloop>
   <tr>
     <td><domino:formlink href="theForm.jsp">
       <domino:viewitem name="Title"/>
     </domino:formlink>
     <td><domino:viewitem name="LastAccessed" format="date=short"/>
     <td><domino:viewitem name="Author"/>
   </tr>
   </domino:viewloop>
 </table>
</domino:view>
</body>
</html>

関連項目