Pages

Friday, September 7, 2012

Tags, Data types and variables expressions and operation

DHTML tag library
JReport DHTML provides a DHTML tag library, which includes custom tags such as mainpage, head, toc and report. These custom tags can be used to componentize JSP pages, increasing productivity and encapsulating recurring tasks so that they can be reused across more than one application.

DHTML tags are classified as below:
  • Embedded tags
  • Component tags
  • Action tags

Before you can use the DHTML tag library in JReport Server, you should firstly copy the file Jinfonet_DHTML_taglib.tld in <intall_root>\public_html\dhtmljsp to the folder where your JSP pages are located.

And if you want to use the DHTML tag library in any web server, you should first:

Add JRWebDesign.jar in <install_root>\lib to the war file you want to publish to the web server.
Add Jinfonet_DHTML_taglib.tld in <intall_root>\public_html\dhtmljsp to the war file in which your JSP pages reside, or alternatively, you can use web.xml to specify a path. For example,


<taglib>
<taglib-uri>Jinfonet_DHTML_taglib</taglib-uri>
<taglib-location>/WEB-INF/Jinfonet_DHTML_taglib.tld</taglib-location>
</taglib>

  • Embedded tags
dhtml
The dhtml tag is a container for the other tags, and it checks user information, runs a report set, and imports resources for the other tags. All tags to be used should be included in this tag. It contains the following attributes:

AttributeDescription
id - stringSpecifies the ID of the tag.
tag setid - stringSpecifies the ID of the tag set. This attribute is required.
user - stringThe username for logging in JReport Server.
password - stringThe user password for logging in JReport Server.
report - stringThe name of the report set the user wants to run. This attribute is required.
catalog - string     The name of the catalog for the report set. This attribute is required.
report_path - stringThe path of the report set.
report_params - stringAll parameters (name/value pair) that are required for running the report set, and the parameters are separated by & character.
catalog _version - integerThe catalog version. Default value is 1.

mainpage
The mainpage tag displays the DHTML page in an IFrame. It contains the following attributes:


  • Component tags
toc
The toc tag is for displaying the TOC Browser.

toolbar
The toolbar tag is for displaying the toolbar.

resview
The resview tag is for displaying the Resource View panel.

toolbox
The toolbox tag is for displaying the Toolbox.

button
The button tag is for displaying buttons which match toolbar buttons but they can be placed anywhere in JReport Viewer.

Attribute Description
buttonidIdentifies the specific button. You can obtain a constant Java class jet.web.dhtml.DHTMLConstant from the package JRWebDesign.jar located at <install_root>\lib. In this class, those constants with a prefix "TOOLBAR_" and of int data type represent the buttonid, and you can then know the buttonid according to the constant name. For example, <jinfonet:button buttonid="<%=String.valueOf(DHTMLConstant.TOOLBAR_NEW)%>"> will display the New button. This attribute is required.

toolboxbutton
The toolboxbutton tag is for displaying buttons which match Toolbox buttons but they can be placed anywhere in JReport Viewer.

Attribute Description
component_type
Identifies the specific button. These constants are available for component_type: "Label", "Image", "Banded Object", "Table", "Crosstab", and "Chart". For example, <jinfonet:toolboxbutton component_type="Banded Object"/> will display the Banded Object button. This attribute is required.

report
The report tag is for DHTML report browser.


  • Action tags

sortform
The sortform tag will generate a form for sorting the data. It contains the following attributes:

>> sortform dhtml image <<

filterform
The filterform tag will generate a form for filtering the data. It contains the following attributes:



column
The column tag will generate a list to provide sorting manners for the sortform tag or field values for the filterform tag. It contains the following attributes:

Data types and variables expressions and operation
The "typeof" operator in JavaScript allows you to probe the datatype of its operand, such as whether a variable is string, numeric, or even undefined.
  • Numbers - are values that can be processed and calculated. You don't enclose them in quotation marks. The numbers can be either positive or negative.
  • Strings - are a series of letters and numbers enclosed in quotation marks. JavaScript uses the string literally; it doesn't process it. You'll use strings for text you want displayed or values you want passed along.
  • Boolean (true/false) - lets you evaluate whether a condition meets or does not meet specified criteria.
  • Null - is an empty value. null is not the same as 0 -- 0 is a real, calculable number, whereas null is the absence of any value.

  • Integers
In JavaScript, you can express integers in 3 different Bases:

  • base 10,
  • base 8 (octal), and
  • base 16 (hexadecimal).

Base 8 numbers can have digits only up to 7, so a decimal value of 18 would be an octal value of 22.

Similarly, hexadecimal allows digits up to F, where A is equivalent to decimal 10 and F is 15. So, a decimal value of 18 would be 12 in hexadecimal notation.

Converting Numbers to Different Bases Table

In order to distinguish between these three bases, JavaScript uses the following notation.

Specifying bases in JavaScript


NUMBER SYSTEMNOTATION
Decimal (base 10)A normal integer without a leading 0 (zero) (ie, 752)
Octal (base 8)An integer with a leading 0 (zero) (ie, 056)
Hexadecimal (base 16)An integer with a leading 0x or 0X (ie, 0x5F or 0XC72)


  • Floating Point Values
Floating point values can include a fractional component. A floating-point literal includes a decimal integer plus either a decimal point and a fraction expressed as another decimal number or an expression indicator and a type suffix

    7.2945
    -34.2
    2e3 means 2 x 103 => 2000
    2E-3 means 2 x 10-3 => .002

Floating point literals must, at a minimum, include a decimal integer and either the decimal point or the exponent indicator ("e" or "E"). As with integers, floating point values can be positive or negative.

  • Strings
Technically, a string literal contains zero or more characters enclosed, as you know, in single or double quotes:

    "Hello!"
    ‘245’
    ""  // This example is called the empty string.

NOTE: the empty string is distinct from the null value in JavaScript.

NOTE: Strings are different from other data types in JavaScript. Strings are actually Objects. This will be covered later on.

  • Boolean
A Boolean value is either true or false.

Note: Unlike Java, C and other languages, in JavaScript Boolean values can only be represented with true and false. Values of 1 and 0 are not considered Boolean values in JavaScript.

  • Null Value
The null value is a special value in JavaScript. The null value represents just that – Nothing. If you try to reference a variable that isn’t defined and therefore has no value, the value returned is the null value. Likewise, with the prompt() dialog box, if the user selects the Cancel button, a null is returned. (example)

NOTE: This is distinct from a value of zero or an empty string where this is an "actual" value. The null value is indicated in JavaScript by the term null.

  • NaN (Not a Number)

In addition to these values, some functions return a special value called NaN – which means that the value is not a number, parseInt() and parseFloat() are an examples of functions that return NaN when the argument passed to them cannot be evaluated to a number.

NOTE: Values can be tested to see if they are NaN by using the isNaN() function which returns true or false based on the nature of the argument passed to the function.

  • Creating Values
In order to make working with data types useful, you need ways to store values for later use. This is where variables come in.



No comments:

Post a Comment