You are on page 1of 22

Virtuas Solutions Jtag Overview Community

Virtuas Solutions, Inc. 14 Inverness Drive East Suite G-228 Englewood, CO 80112 Phone 303.768.8808 Fax 303.768.0782

T able of Contents
Introduction ............................................ 1 < jtagcomm:rsIterator /> ........................ 2 Attribute Definitions.............................. 2 Example................................................ 3 < jtagcomm:rsGetProperty />................. 3 Attribute Definitions.............................. 3 < jtagcomm:query />............................... 4 Attribute Definitions.............................. 4 Example................................................ 5 < jtagcomm:if /> ...................................... 6 Attribute Definitions.............................. 6 Example................................................ 6 < jtagcomm:else /> .................................. 6 Attribute Definition ............................... 6 < jtagcomm:elseIf />................................ 7 Attribute Definitions.............................. 7 Appendix D............................................ 20 Example .............................................. 20 Appendix B ............................................ 12 Appendix C............................................ 15 < jtagcomm:forward /> ...........................7 Attribute Definitions..............................7 Example ................................................7 < jtagcomm:properties />........................8 Attribute Definitions..............................8 Example ................................................8 < jtagcomm:dateFormat /> .....................9 Attribute Definitions..............................9 Example .............................................. 11 Appendix A............................................ 11

J T A G O V E R V I E W C O M M U N I T Y

FOREWORD

The future of enterprise application development is assembly. We no longer have the time or resources to reinvent the wheel with every development effort. To be successful on an enterprise level, we must assemble existing components in accelerated timelines. JavaServer Page custom tags provide web assemblers with the ability to build web applications with little more than dragging and dropping. The Virtuas jtagwireless library takes this approach to the wireless application arena.

Assemble, don't develop.


James Goodwill, III Chief Technology Officer Virtuas Solutions, Inc. Author, Developing Java Servlets (ISBN 0672316005) Pure JavaServer Pages (ISBN 0672319020)

Introduction
This document describes the Virtuas Solutions, Inc. jtag custom tag library. It provides the developer with all the necessary documentation to assemble JSP applications. The library is based on Sun MicroSystems JavaServer Page 1.1 specification.

J T A G O V E R V I E W C O M M U N I T Y

Community Tag Library


< jtagcomm:rsIterator />
A T T R I B U T E S

id objectid scope start max forward


Attribute Definitions

The <jtagcomm:rsIterator> tag iterates over a Java ResultSet that exists in the specified scope. With each iteration, an object matching a row in the ResultSet is made available in the scope of the page. The object must be accessed using the <jtagcomm:rsGetProperty> tag described in the following section.

id objectid scope

The id attribute defines the id of the Java ResultSet to iterate over. This attribute is required. The objectid attribute defines the name used to store the current row in the page scope. This attribute is required. The scope attribute defines the scope naming the location of the Java ResultSet. This attribute is optional. The default is page. The start attribute defines where in the Java Collection to start iterating. This attribute is optional. The default is 0. The max attribute defines the maximum number of objects to iterate over. This attribute is optional. The default is all. The forward attribute is a boolean value that determines the direction to iterate over the collection ResultSet (true|false). True denotes forward, and false denotes backward. This attribute is optional. The default is true.

start max forward

J T A G O V E R V I E W C O M M U N I T Y

Example
<table border="1" cellpadding="0" cellspacing="2" width="100%"> <jtagcomm:rsIterator id="sqltest" objectid="title" scope="page" max="10" > <tr> <td>< jtagcomm:rsGetProperty id="title" property="OrderID" /></td> <td>< jtagcomm:rsGetProperty id="title" property="CustomerID" /></td> <td>< jtagcomm:rsGetProperty id="title" property="OrderDate" /></td> </tr> </jtagcomm:rsIterator> </table>

< jtagcomm:rsGetProperty />


A T T R I B U T E S

id property
Attribute Definitions

The <jtagcomm:rsGetProperty> tag is used within the <jtagcomm:rsIterator> tag to retrieve a column value from the current row of the ResultSet.

id

The id attribute defines the name of the current row that is stored in the page scope. This value corresponds to the objectid attribute of the <jtagcomm:rsIterator> that is handling the ResultSet. This attribute is required. The property attribute defines the name of the column whose value will be returned. This attribute is required.

property

See <jtagcomm:rsIterator> for an example.

J T A G O V E R V I E W C O M M U N I T Y

< jtagcomm:query />


A T T R I B U T E S

objectid datasourcename driver username password url objectscope logintimeout querytimeout maxrows fetchsize debug
Attribute Definitions

The <jtagcomm:query> tag performs basic SQL queries. The results from the query are placed in a Java ResultSet object within the specified scope. This tag can be used in conjunction with the <jtagcomm:rsIterator> tag, in the Jtag Community package, to display or iterate through the results for other processing purposes.

objectid datasourcename

The objectid attribute defines the name that is associated with the resulting ResultSet. This attribute is required. The datasourcename attribute defines the name of the DataSource to use. This attribute is not used if the driver and url attributes are set. This attribute is required only when driver and url are not present. The driver attribute defines the name of the SQL Driver to use. This attribute is not used if datasourcename is set. This attribute is required only when datasourcename is not present. The username attribute defines the name to use when logging into the SQL Database. This attribute is not used if datasourcename is set. This attribute is optional. The password attribute defines the password of the associated username needed to log into the SQL database. This attribute is not used if datasourcename is set. This attribute is optional

driver

username

password

J T A G O V E R V I E W C O M M U N I T Y

url

The url attribute defines the name and location of the SQL Database to use for the database operation. This attribute is not used if datasourcename is set. This attribute is required only when datasourcename is not present. The objectscope attribute defines the scope that the ResultSet is placed in. This attribute is optional. The default is page. The logintimeout attribute defines the length of time (in milliseconds) to wait for login. This attribute is optional. The default is JDBC default. The querytimeout attribute defines the length of time (in milliseconds) to wait for the query to return. This attribute is optional. The default is JDBC default. The maxrows attribute sets the maximum number of rows to return. This attribute is optional. The default is all rows. The fetchsize attribute sets the number of rows to return for each fetch. This attribute is optional. The default is JDBC default. The debug attribute turns on debug messages. All debug messages are routed to the application servers standard error. This attribute is optional. The default is false.

objectscope logintimeout

querytimeout

maxrows fetchsize

debug

The following example retrieves all first names, last names, and email addresses from a registration database.
Example
<jtagcomm:query objectid="test" driver="sun.jdbc.odbc.JdbcOdbcDriver" url="Jdbc:Odbc:sql-local" username="testuser" password="testuser" debug='true'> select first_name, last_name, email_addr from registration </jtagcomm:query>

J T A G O V E R V I E W C O M M U N I T Y

< jtagcomm:if />


A T T R I B U T E S

name condition
Attribute Definitions

The <jtagcomm:if> tag evaluates a Java boolean native type and processes the body of the JSP tag according to the results.

name

The name attribute identifies a unique identifier for a particular if tag. This name is used to associate <jtagcomm:elseIf> and <jtagcomm:else> tags with this <jtagcomm:if> tag.. This attribute is required. The condition attribute identifies the condition to be tested. This condition must evaluate to a boolean value, true or false. This attribute is required.

condition

Example
<jtagcomm:if name="checkValue" condition='<%= (x == 12) %>'> <p> x = 12 </p> </jtagcomm:if> <jtagcomm:elseIf name="checkValue" condition='<%= (x == 16) %>' > <p> x = 16 </p> </jtagcomm:elseIf> <jtagcomm:else name="checkValue"> <p> x not equal to 12 or 16</p> </jtagcomm:else>

< jtagcomm:else />


A T T R I B U T E

name
Attribute Definition

The <jtagcomm:else> tag evaluates its body if its matching <jtagcomm:if> statement and all matching <jtagcomm:elseIf> statements evaluated to false. This is the default case for the if and elseif conditionals. The name attribute identifies the matching <jtagcomm:if> tag. This name must match the value of the name attribute for a <jtagcomm:if> tag that is used previously in the JSP. This attribute is required.

name

See <jtagcomm:if> for example.

J T A G O V E R V I E W C O M M U N I T Y

< jtagcomm:elseIf />


A T T R I B U T E S

name condition

The <jtagcomm:elseIf> tag evaluates a Java boolean native type and processes the body of the JSP tag according to the results only if a prior associated <jtagcomm:if> statement did not evaluate to true.

Attribute Definitions

name

The name attribute identifies the matching <jtagcomm:if> tag. This name must match the value of the name attribute for a <jtagcomm:if> tag that is used previously in the JSP. This attribute is required. The condition attribute identifies the condition to be tested. This condition must evaluate to a boolean value, true or false. This attribute is required.

condition

See <jtagcomm:if> for example.

< jtagcomm:forward />


A T T R I B U T E S

uri

The <jtagcomm:forward> tag forwards the current request to the specified URI. The HttpServletRequest and HttpServletResponse objects remain intact. Parameters can be added to the request before forwarding by including one or more <jtagobject:parameter> tags, from the Jtag Object Library, into the body. The uri attribute defines the relative URI to forward the request to. If the uri begins with a / then the URL specified is calculated relative to the DOCROOT of the ServletContext for this JSP. If the path does not begin with a / then the URL specified is calculated relative to the URL of the request that was mapped to the calling JSP. This attribute is required.

Attribute Definitions

uri

Example
<jtagcomm:forward uri="ldapTest.jsp" > <jtagobject:parameter id="testParam" value="TESTING" textvalue="true" /> <jtagobject:parameter id="testParam2" scope="session" /> </jtagcomm:forward>

J T A G O V E R V I E W C O M M U N I T Y

< jtagcomm:properties />


A T T R I B U T E S

objectid objectscope filename propertiesobject

The <jtagcomm:properties> tag allows users to place a Java Properties object into the context of their choice. This allows easy access to the properties file within a JSP.

Attribute Definitions

objectid objectscope

The objectid attribute defines the name this properties object is known by. This attribute is required. The objectscope attribute defines the scope that the Properties object is placed in. This attribute is optional. The default is page. The filename attribute defines the fully qualified path to the properties file to load. This attribute is required only when propertiesobject is not present. With the propertiesobject attribute, the user may specify a previously created java.util.Properties object in the requested scope. This attribute is required only when filename is not present.

filename

propertiesobject

Example
<jtagcomm:properties name="props" filename="c:\\jakarta-tomcat\\webapps\\products\\web-inf\\virtuas.props" />

J T A G O V E R V I E W C O M M U N I T Y

< jtagcomm:dateFormat />


A T T R I B U T E S

date locale day month year hours minutes seconds language country displaytime timestyle datestyle
Attribute Definitions

The <jtagcomm:dateFormat> tag formats a date based on a specific Locale. The date can be assigned using individual attributes for day, month, year, etc, or as a java.util.Date object. It also accepts locale information as well as formatting options that are used to format the output of the date. If no date information is passed to the tag, the current date and time of the server is used. If no locale information is supplied the tag attempts to acquire locale first from the clients browser, then from the server. Allowing the locale information to default to the clients browser is the preferred method.

date

An instance of the java.util.Date class, the date attribute contains the date to be formatted. The tag looks for this attribute first for the date information. If it is not present, the tag looks for the individual date elements. This attribute is optional. An instance of the java.util.Locale class, the locale attribute contains the locale information for formatting the date. The tag looks for this attribute first for locale information. If it is not present, the tag looks next for the country and language attributes. This attribute is optional. The day attribute defines the day element of the date given as an integer value. Day, month, and year are necessary to form a date specified by these individual attributes. If one is provided without the other two, current server time is used by default. This attribute is optional.

locale

day

J T A G O V E R V I E W C O M M U N I T Y

month

The month attribute defines the month element of the date given as an integer value. Day, month, and year are necessary to form a date specified by these individual attributes. If one is provided without the other two, current server time is used by default. This attribute is optional. The year attribute defines the year element of the date given as a four digit integer value. Day, month, and year are necessary to form a date specified by these individual attributes. If one is provided without the other two, current server time is used by default. This attribute is optional. The hours attribute defines the hours element of the date given as an integer value based on a 24-hour clock. This attribute is optional. The minutes attribute defines the minutes element of the date given as an integer value. This attribute is optional. The seconds attribute defines the seconds element of the date given as an integer value. This attribute is optional. The language attribute defines a lowercase two-letter ISO-639 code specifying the language for the locale. See Appendix B for a listing of the acceptable ISO-639 codes. This attribute is optional. The country attribute defines a uppercase two-letter ISO-3166 code specifying the country for the locale. See Appendix C for a listing of the acceptable ISO-3166 codes. This attribute is optional. The displaytime attribute determines whether or not the time is displayed with the date (true|false). This attribute is optional. The default is false. The timestyle attribute defines the style that the time is displayed in, if it is displayed. This attribute is optional. Values:
short HH:MM PM

year

hours

minutes seconds language

country

displaytime

timestyle

medium HH:MM:SS PM (default) long/full HH:MM:SS PM MST

10

J T A G O V E R V I E W C O M M U N I T Y

datestyle

The datestyle attribute defines the style that the date is displayed in. This attribute is optional. Values:
short long full M/D/YY January 9, YYYY Tuesday, January 9, YYYY

medium Jan 9, YYYY (default)

Example
<jtagcomm:dateFormat day="20" month="6" year="1992" hours="26" minutes="70" seconds="0" displaytime="true" datestyle="long" /> <jtagcomm:dateFormat displaytime="true" language="fr" />

Appendix A
Common Attribute Quick Reference id scope The id attribute names an object being passed to the tag. The object named by the id attribute exists within the scope defined by this attribute. Values:
application page request session

objectid objectscope

The objectid attribute names an object that is returned from the tag. The object named by the objectid attribute is placed within the scope defined by this attribute. Values:
application page request session 11

J T A G O V E R V I E W C O M M U N I T Y

name

The name attribute defines a generic name for the tag.

Appendix B
ISO 639 CodesNames of Languages Two-letter lower-case symbols are used
Abkhazian Afar Afrikaans Albanian Amharic Arabic Armenian Assamese Aymara Azerbaijani Bashkir Basque Bengali; Bangla Bhutani Bihari Bislama Breton Bulgarian Burmese Byelorussian Cambodian Catalan Chinese Corsican Croatian Czech Danish Dutch English Esperanto Estonian Faeroese Fiji Finnish French Frisian Galician Georgian German Greek Greenlandic Guarani Gujarati 12 ab aa af sq am ar hy as ay az ba eu bn dz bh bi br bg my be km ca zh co hr cs da nl en eo et fo fj fi fr fy gl ka de el kl gn gu

J T A G O V E R V I E W C O M M U N I T Y

Hausa Hebrew Hindi Hungarian Icelandic Indonesian Interlingua Interlingue Inupiak Irish Italian Japanese Javanese Kannada Kashmiri Kazakh Kinyarwanda Kirghiz Kirundi Korean Kurdish Laothian Latin Latvian, Lettish Lingala Lithuanian Macedonian Malagasy Malay Malayalam Maltese Moldavian Mongolian Maori Marathi Nauru Nepali Norwegian Occitan Oriya Oromo (Afan) Pashto, Pushto Persian Polish Portuguese Punjabi Quechua Rhaeto-Romance Romanian Russian Samoan Sangro 13

ha iw hi hr is in ia ie ik ga it ja jw kn ks kk rw ky rn ko ku lo la lv ln lt mk mg ms ml mt mo mn mi mr na ne no oc or om ps fa pl pt pa qu rm ro ru sm sg

J T A G O V E R V I E W C O M M U N I T Y

Sanskrit Scots Gaelic Serbian Sesotho Serbo-Croatian Setswana Shona Sindhi Singhalese Siswati Slovak Slovenian Somali Spanish Sundanese Swahili Swedish Tagalog Tajik Tamil Tatar Telugu Thai Tibetan Tigrinya Tonga Tsonga Turkish Turkmen Twi Ukrainian Urdu Uzbek Vietnamese Volapuk Welsh Wolof Xhosa Yiddish Yoruba Zulu

sa gd sr st sh tn sn sd si ss sk sl so es su sw sv tl tg ta tt te th bo ti to ts tr tk tw uk ur uz vi vo cy wo xh ji yo zu

14

J T A G O V E R V I E W C O M M U N I T Y

Appendix C
ISO 3166 CodesCountries Two-letter upper-case symbols are used.
Afghanistan Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua And Barbuda Argentina Armenia Aruba Australia Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia And Herzegowina Botswana Bouvet Island Brazil British Indian Ocean Territory Brunei Darussalam Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Cape Verde Cayman Islands Central African Republic Chad Chile China 15 AF AL DZ AS AD AO AI AQ AG AR AM AW AU AT AZ BS BH BD BB BY BE BZ BJ BM BT BO BA BW BV BR IO BN BG BF BI KH CM CA CV KY CF TD CL CN

J T A G O V E R V I E W C O M M U N I T Y

Christmas Island Cocos (Keeling) Islands Colombia Comoros Congo Cook Islands Costa Rica Cote d'Ivoire Croatia (local name: Hrvatska) Cuba Cyprus Czech Republic Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Eritrea Estonia Ethiopia Falkland Islands (Malvinas) Faroe Islands Fiji Finland France France, Metropolitan French Guiana French Polynesia French Southern Territories Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guadeloupe Guam Guatemala Guinea Guinea-Bissau Guyana Haiti Heard And Mc Donald Islands Holy See (Vatican City State) Honduras 16

CX CC CO KM CG CK CR CI HR CU CY CZ DK DJ DM DO TP EC EG SV GQ ER EE ET FK FO FJ FI FR FX GF PF TF GA GM GE DE GH GI GR GL GD GP GU GT GN GW GY HT HM VA HN

J T A G O V E R V I E W C O M M U N I T Y

Hong Kong Hungary Iceland India Indonesia Iran (Islamic Republic Of) Iraq Ireland Israel Italy Jamaica Japan Jordan Kazakhstan Kenya Kiribati Korea, Democratic People's Republic Of Korea, Republic Of Kuwait Kyrgyzstan Lao People's Democratic Latvia Lebanon Lesotho Liberia Libyan Arab Jamahiriya Liechtenstein Lithuania Luxembourg Macau Macedonia, The Former Yugoslav Republic Of Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Martinique Mauritania Mauritius Mayotte Mexico Micronesia, Federated States Of Moldova, Republic Of Monaco Mongolia Montserrat Morocco Mozambique Myanmar Namibia 17

HK HU IS IN ID IR IQ IE IL IT JM JP JO KZ KE KI KP KR KW KG RE LV LB LS LR LY LI LT LU MO MK MG MW MY MV ML MT MH MQ MR MU YT MX FM MD MC MN MS MA MZ MM NA

J T A G O V E R V I E W C O M M U N I T Y

Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niger Nigeria Niue Norfolk Island Northern Mariana Islands Norway Oman Pakistan Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Reunion Romania Russian Federation Rwanda Saint Kitts And Nevis Saint Lucia Saint Vincent And The Grenadines Samoa San Marino Sao Tome And Principe Saudi Arabia Senegal Seychelles Sierra Leone Singapore Slovakia (Slovak Republic) Slovenia Solomon Islands Somalia South Africa South Georgia And The South Sandwich Islands Spain Sri Lanka St. Helena St. Pierre And Miquelon Sudan 18

NR NP NL AN NC NZ NI NE NG NU NF MP NO OM PK PW PA PG PY PE PH PN PL PT PR QA RE RO RU RW KN LC VC WS SM ST SA SN SC SL SG SK SI SB SO ZA GS ES LK SH PM SD

J T A G O V E R V I E W C O M M U N I T Y

Suriname Svalbard And Jan Mayen Islands Swaziland Sweden Switzerland Syrian Arab Republic Taiwan, Province Of China Tajikistan Tanzania, United Republic Of Thailand Togo Tokelau Tonga Trinidad And Tobago Tunisia Turkey Turkmenistan Turks And Caicos Islands Tuvalu Uganda Ukraine United Arab Emirates United Kingdom United States United States Minor Outlying Islands Uruguay Uzbekistan Vanuatu Venezuela Viet Nam Virgin Islands (British) Virgin Islands (U.S.) Wallis And Futuna Islands Western Sahara Yemen Yugoslavia Zaire Zambia Zimbabwe

SR SJ SZ SE CH SY TW TJ TZ TH TG TK TO TT TN TR TM TC TV UG UA AE GB US UM UY UZ VU VE VN VG VI WF EH YE YU ZR ZM ZW

19

J T A G O V E R V I E W C O M M U N I T Y

Appendix D
The following is an example of the Community tags:
Example
<%@ taglib uri="/jtagcomm" prefix="jtagcomm" %> <html> <head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title>JTag SQL Test Page</title> </head> <body bgcolor="#ffffff"> <jtagcomm:query objectid="test" driver="sun.jdbc.odbc.JdbcOdbcDriver" url="Jdbc:Odbc:testdb" username="username" password="password" maxrows="10"> select * from Customers </jtagcomm:query> <table width="80%"> <jtagcomm:rsIterator id="test" objectid="customer"> <tr> <td><jtagcomm:rsGetProperty id="customer" property="CustomerID" /></td> <td><jtagcomm:rsGetProperty id="customer" property="CompanyName" /></td> <td><jtagcomm:rsGetProperty id="customer" property="ContactName" /></td> <td><jtagcomm:rsGetProperty id="customer" property="City" /></td> <td><jtagcomm:rsGetProperty id="customer" property="Country" /></td> </tr> </jtagcomm:rsIterator> </table><br> </body> </html>

20

You might also like