# Index.jsp Sample

This topic inludes the source code for the Index.jsp Sample.

## Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui/formatTags/

## Sample Source Code

`001 <%-- 002 This JSP page shows how to use the <netui:formatString>, <netui:formatNumber>, 003 and <netui:formatDate> tags. 004 --%> 005 <%@ page language="java" contentType="text/html;charset=UTF-8"%> 006 <%@ taglib uri="netui-tags-databinding.tld" prefix="netui-data"%> 007 <%@ taglib uri="netui-tags-html.tld" prefix="netui"%> 008 <%@ taglib uri="netui-tags-template.tld" prefix="netui-template"%> 009 <html> 010 <head> 011 <netui:base/> 012 <title>Formatting Strings, Numbers, Dates</title> 013 <link href="../../../resources/css/style.css" type="text/css" rel="stylesheet"/> 014 </head> 015 016 <body> 017 018 <jsp:include page="/resources/jsp/header.jsp"/> 019 020 <blockquote> 021 022 <h3>Formatting Tags Sample</h3> 023 024 <p>This sample demonstrates the use of the 025 &lt;netui:formatString>, &lt;netui:formatNumber>, and 026 &lt;netui:formatDate> tags. For examples of the tag 027 attributes, see the pre-rendered source of this JSP in 028 /formatTags/index.jsp, and also see the 029 /formatTags/formatTagsController.jpf page flow controller.</p> 030 031 032 <!-- 033 netui:formatString samples 034 --> 035 <table border="1" cellpadding="5"> 036 <thead><tr><th colspan="2" style="background-color:#ccffcc;">&lt;netui:formatString Samples</th></tr></thead> 037 <tr class="row-text"> 038 <td> 039 <b>Format Tag</b> 040 </td> 041 <td> 042 <b>Output from Format Tag</b> 043 </td> 044 </tr> 045 <tr class="row-text"> 046 <td> 047 &lt;netui:formatString pattern="phone (###) ###-####"/> 048 </td> 049 <td> 050 <netui:label value="2125555555"> 051 <netui:formatString pattern="phone (###) ###-####"/> 052 </netui:label> 053 </td> 054 </tr> 055 <tr class="row-text"> 056 <td> 057 &lt;netui:formatString pattern="Social Security $#: ###-##-####"/> 058 </td> 059 <td> 060 <netui:label value="222222222"> 061 <netui:formatString pattern="Social Security $#: ###-##-####"/> 062 </netui:label> 063 </td> 064 </tr> 065 </table> 066 067 068 <!-- 069 netui:formatNumber samples 070 --> 071 <table border="1" cellpadding="5"> 072 <thead><tr><th colspan="2" style="background-color:#99ffcc;">&lt;netui:formatNumber Samples</th></tr></thead> 073 <tr class="row-text"> 074 <td> 075 <b>Format Tag</b> 076 </td> 077 <td> 078 <b>Output from Format Tag</b> 079 </td> 080 </tr> 081 <tr class="row-text"> 082 <td> 083 &lt;netui:formatNumber type="currency" /> 084 </td> 085 <td> 086 <netui:label value="1234567.89"> 087 <netui:formatNumber type="currency" /> 088 </netui:label> 089 </td> 090 </tr> 091 <tr class="row-text"> 092 <td> 093 &lt;netui:formatNumber type="currency" country="FR" language="fr" /> 094 </td> 095 <td> 096 <netui:label value="1234567.89"> 097 <netui:formatNumber type="currency" country="FR" language="fr" /> 098 </netui:label> 099 </td> 100 </tr> 101 <tr class="row-text"> 102 <td> 103 &lt;netui:formatNumber type="number" country="DE" language="de" /> 104 </td> 105 <td> 106 <netui:label value="1234567.89"> 107 <netui:formatNumber type="number" country="DE" language="de" /> 108 </netui:label> 109 </td> 110 </tr> 111 <tr class="row-text"> 112 <td> 113 &lt;netui:formatNumber type="currency" country="US" language="en" /> 114 </td> 115 <td> 116 <netui:label value="14.317"> 117 <netui:formatNumber type="currency" country="US" language="en" /> 118 </netui:label> 119 </td> 120 </tr> 121 <tr class="row-text"> 122 <td> 123 <p>Note that the next three samples have different pattern attributes, but the same 124 output. This is because the right-most, comma-delimited interval (,###) in each pattern determines 125 the interval used throughout, the other intervals are ignored.</p> 126 &lt;netui:formatNumber pattern="#,##,###" /> 127 </td> 128 <td> 129 <netui:label value="123456789"> 130 <netui:formatNumber pattern="#,##,###" /> 131 </netui:label> 132 </td> 133 </tr> 134 <tr class="row-text"> 135 <td> 136 &lt;netui:formatNumber pattern="######,#####,####,###" /> 137 </td> 138 <td> 139 <netui:label value="123456789"> 140 <netui:formatNumber pattern="######,#####,####,###" /> 141 </netui:label> 142 </td> 143 </tr> 144 <tr class="row-text"> 145 <td> 146 &lt;netui:formatNumber pattern="##,###,###" /> 147 </td> 148 <td> 149 <netui:label value="123456789"> 150 <netui:formatNumber pattern="##,###,###" /> 151 </netui:label> 152 </td> 153 </tr> 154 </table> 155 156 157 <!-- 158 netui:formatDate samples 159 --> 160 <table border="1" cellpadding="5"> 161 <thead><tr><th colspan="2" style="background-color:#66ffcc;">&lt;netui:formatDate Samples</th></tr></thead> 162 <tr class="row-text"> 163 <td> 164 <b>Format Tag</b> 165 </td> 166 <td> 167 <b>Output from Format Tag</b> 168 </td> 169 </tr> 170 <tr class="row-text"> 171 <td> 172 &lt;netui:formatDate pattern="MMMM dd, yyyy" /> 173 </td> 174 <td> 175 <netui:label value="{pageFlow.date}"> 176 <netui:formatDate pattern="MMMM dd, yyyy" /> 177 </netui:label> 178 </td> 179 </tr> 180 <tr class="row-text"> 181 <td> 182 &lt;netui:formatDate pattern="EEEE, MMMM dd, yyyy: hh:mm a" /> 183 </td> 184 <td> 185 <netui:label value="{pageFlow.date}"> 186 <netui:formatDate pattern="EEEE, MMMM dd, yyyy: hh:mm a" /> 187 </netui:label> 188 </td> 189 </tr> 190 <tr class="row-text"> 191 <td> 192 &lt;netui:formatDate pattern="MM.dd.yyyy, HH:mm:ss z" /> 193 </td> 194 <td> 195 <netui:label value="{pageFlow.date}"> 196 <netui:formatDate pattern="MM.dd.yyyy, HH:mm:ss z" /> 197 </netui:label> 198 </td> 199 </tr> 200 </table> 201 202 </blockquote> 203 204 <hr> 205 <netui:anchor href="/WebApp/tagSamples/tagSamplesController.jpf">Return to Tag Samples</netui:anchor> 206 207 </body> 208 209 </html>`