Guide for RS statement & tag

RS statement is used for reading datas of topic or ORACLE data from sql. All statements can be nested in RS statement

Note:Data such as BLOB、JAVA_OBJECT、LONGVARBINARY、VARBINARY、STRUCT、REF、DATALINK、LONGVARCHAR、OTHER、DISTINCT is not supported. All the data above will be skipped and return to NULL.

RS grammar

<rs id=(id:STRING) sql=(sql:STRING) topic=(topic:STRING) where=(where:STRING) orderby="orderby:STRING" from=(from:int) rows=(rows:int) page=(page:int) style=(style:STRING)>
    --Input your text content here
</rs>

SQL and topic parameter must be placed after id parameter and before other parameters.



How to customize pagination style

Please use JAVA statement to set all fields showed below before RS statement.
ATTENTION PLS:
1.please re-set all fields but not one of them only.
2.If you only want to customize your CSS style, please just do it with /css/pagebreak.css
3.Format String Syntax, please see java Formatter class for more detail:
The format specifiers for general, character, and numeric types have the following syntax:
%[argument_index$][flags][width][.precision]conversion

The optional argument_index is a decimal integer indicating the position of the argument in the argument list. The first argument is referenced by "1$", the second by "2$", etc.

The optional flags is a set of characters that modify the output format. The set of valid flags depends on the conversion.

The optional width is a non-negative decimal integer indicating the minimum number of characters to be written to the output.

The optional precision is a non-negative decimal integer usually used to restrict the number of characters. The specific behavior depends on the conversion.

The required conversion is a character indicating how the argument should be formatted. The set of valid conversions for a given argument depends on the argument's data type.

Conversion Argument Category Description
'b', 'B' general If the argument arg is null, then the result is "false". If arg is a boolean or Boolean, then the result is the string returned by String.valueOf(arg). Otherwise, the result is "true".
'h', 'H' general If the argument arg is null, then the result is "null". Otherwise, the result is obtained by invoking Integer.toHexString(arg.hashCode()).
's', 'S' general If the argument arg is null, then the result is "null". If arg implements Formattable, then arg.formatTo is invoked. Otherwise, the result is obtained by invoking arg.toString().
'c', 'C' character The result is a Unicode character
'd' integral The result is formatted as a decimal integer
'o' integral The result is formatted as an octal integer
'x', 'X' integral The result is formatted as a hexadecimal integer
'e', 'E' floating point The result is formatted as a decimal number in computerized scientific notation
'f' floating point The result is formatted as a decimal number
'g', 'G' floating point The result is formatted using computerized scientific notation or decimal format, depending on the precision and the value after rounding.
'a', 'A' floating point The result is formatted as a hexadecimal floating-point number with a significand and an exponent
't', 'T' date/time Prefix for date and time conversion characters. See Date/Time Conversions.
'%' percent The result is a literal '%' ('\u0025')
'n' line separator The result is the platform-specific line separator

For example, below shows how to get a pagination without summary bar and select box.
<%
    PAGEBREAK_HEADER = "<div class='pagebreak_modern'>";
    PAGEBREAK_PREVPAGE = "<span class='prevpage'><a href='%1$s'>Previous</a></span>";
    PAGEBREAK_NEXTPAGE = "<span class='nextpage'><a href='%1$s'>Next</a></span>";
    PAGEBREAK_SKIP = "<span class='omit'>...</span>";
    PAGEBREAK_PAGE = "<span class='page'><a href='%1$s'>%2$s</a></span>";
    PAGEBREAK_CURRENTPAGE = "<span class='currentpage'><a href='%1$s'>%2$s</a></span>";
    PAGEBREAK_TOTAL = null;
    PAGEBREAK_SELECTBOX = null;
    PAGEBREAK_FOOTER = "</div>";
%>

Default field settings for modern style



Default field settings for onebyone style



Guide for using tags within RS statement

1.Tags begin with “<$”, and end with “$>”
2.The id of RS statement must be prefixed to tag,i.e.:<$rs1.productname$>.Note: ID’s case sensitivity should be in accordance with the definition. The afterwards variables are not case sensitive.
3.The Tag of “rowno” represents the row number of RS,It is integer,i.e.:<$rs1.rowno$>。
4.The RS statement which adopt “topic” parameter could use article tag. Note: for self-defined data source, only these artcile tags can be used: <$art_id$>、<$art_title$>、<$art_url$>、<$art_createdate$> and <$art_publishdate$>.
5.You can use ATTACH statement in the RS statement. Generally, the attachment tag doesn’t work (namely no any data.) unless the self-defined datasource is customized (e.g.: product management).
6.The RS statement which adopt "sql" parameter could use tags with the SQL name.
7.You can put parentheses right after parameter name in which you should put format parameter or limited condition on word amount.i.e.:<$rs1.productname(50)$>. For different types of data, it generally means:

      1)String type: <$rs1.productname(50)$> means to take 50 characters from front to back, one Chinese character accounts for one character.
<$rs1.productname(50,"...")$> means to take 50 characters from front to back.The characters more the 50 will be truncated,and "..." appended.


      2)Decimal type:Below is the detailed instruction:

Symbol Location Meaning
0 Number Digit
# Number Digit, zero shows as absent
. Number Decimal separator or monetary decimal separator
- Number Minus sign
, Number Grouping separator
E Number Separates mantissa and exponent in scientific notation. Need not be quoted in prefix or suffix.
; Subpattern boundary Separates positive and negative subpatterns
% Prefix or suffix Multiply by 100 and show as percentage
\u2030 Prefix or suffix Multiply by 1000 and show as per mille
¤ (\u00A4) Prefix or suffix Currency sign, replaced by currency symbol. If doubled, replaced by international currency symbol. If present in a pattern, the monetary decimal separator is used instead of the decimal separator.
' Prefix or suffix Used to quote special characters in a prefix or suffix, for example, "'#'#" formats 123 to "#123". To create a single quote itself, use two in a row: "# o''clock".

      3)Date type:formatted character string, for example: <$rs.salesdate("yyyyMMdd")$>. The default format is "yyyy-MM-dd". Below is the detailed instruction:
Letter
Date or Time Component
Presentation
Example
G
Era designator
Text
AD
y
year
Year
1996; 96
M
Month in year
Month
July; Jul; 07
w
Week in year
Number
27
W
Week in month
Number
2
D
Day in year
Number
189
d
Day in month
Number
10
F
Day of week in month
Number
2
E
Day in week
Text
Tuesday; Tue
a
Am/pm marker
Text
PM
H
Hour in day (0-23)
Number
0
k
Hour in day (1-24)
Number
24
K
Hour in am/pm (0-11)
Number
0
h
Hour in am/pm (1-12)
Number
12
m
Minute in hour
Number
30
s
Second in minute
Number
55
S
Millisecond
Number
978
z
Time zone
General time zone
Pacific Standard Time; PST; GMT-08:00
Z
Time zone
RFC 822 time zone
-0800

      4)CLOB type
      1."0" or "text" represents the formatted plain text (All HTML tags, space, HTML space will be neglected except the full-shaped space.).
          e.g.: <$rs1.content("text")$> will return to the formatted content data.
<$rs1.content("text",50)$> will return to 50 characters of formatted content data,data more the 50 will be truncated.
<$rs1.content("text",50,"...")$> will return to 50 characters of formatted content data,data more the 50 will be truncated,and "..." appended.
      2.The number represents the amount which will be fetched. It will be auto-formatted into plain text and return.
          e.g.: <$rs1.content(500)$> will return to the formatted front 500 characters. One Chinese character accounts for one character.
<$rs1.content(500,"...")$> will return to 500 characters of formatted content data,data more the 500 will be truncated,and "..." appended.



Sample Coding

Get all articles in current topic.
<rs id="rs1">
     <$rs1.art_title$>
</rs>

Same as top.Get all articles in current topic.
<rs id="rs1" topic=<$top_code$>>
     <$rs1.art_title$>
</rs>

Get all articles which importance is "very important", and order by publish date
<rs id="rs1" topic=<$top_code$> where="a.important=2" orderby="a.publishdate">
     <$rs1.art_title$>
</rs>

Get top 20 articles in topic coded in "top1"
<rs id="rs1" topic="top1" rows=20>
     <$rs1.art_title$>
</rs>

Get all articles in current topic,andin display pages by 20 pieces of articles per page
<rs id="rs1" page=20>
     <$rs1.art_title$>
</rs>

Get top 20 rows from database
<rs id="rs1" sql="select productid,productname from product" rows=20>
     <$rs1.productname$>
</rs>

Get products' list and get customer with each product.
<rs id="rs1" sql="select productid,productname from product">
     <$rs1.productname$>
     <rs id="rs2" sql=<%="select customer from sales where productid=" + <$rs1.productid$>%>>
         <$rs2.customer$>
     </rs>
</rs>