Professional Documents
Culture Documents
Telosys 1
What are symbolic variables ?
The symbolic variables are completely
independent of the standard JSP Expression
Language ( "EL" ). They can be used even in old
Java servers that doesn't support EL and JSTL.
Where can they be used ?
In the "v" attribute of "t:out"
In every event attributes : onclick, onblur, …
In the specific following attributes :
id name
value txt valueoff
title zone checked
cl style selected
disabled readonly
Telosys framework - Symbolic variables ( Laurent Guérin ) 3
@{#screenmap-url} "http://localhost:8080/appli/screenmap"
@{#screenmap-uri} "/appli/screenmap"
Telosys 2
Symbolic variables : predefined values
HTTP request parameters :
@{#paramcount} number of parameters
@{#param-xxx} value of the "xxx" parameter
Iterations :
@{#count} the current count value ( from 1 to n )
@{#count-parity} "even" or "odd"
Telosys 3
Symbolic variables for Java beans
Any Java bean can be accessed with the standard
"dot" notation :
@{agency.city} value of the attribute "city" of the bean
"agency"
@{.city} value of the attribute "city" of the "current
bean" ( the "." in first position defines an attribute )
@{agency} string value of the bean "agency"
( using the "toString" method of the bean )
Example :
<t:out v="The agency city is @{agency.city,NO CITY}"/>
4 – screen-session ( Telosys )
6 – screen-application ( Telosys )
Telosys 4
Symbolic variables and services
Special bean name :
"RENDERER-BEAN" ( or "RENDERER_BEAN" )
points the "service result" object
( this special name is usable only in a service renderer )
Example :
Agency result = new Agency();
serviceResponse.setResult(result);
</t:list>
Telosys 5
Symbolic variables for DataSet
DataSet cells can be accessed with a number
corresponding to the column number of the
current DataRow ( 1 to n ) :
@{.1} or @{1} value of the column 1
@{.2} or @{2} value of the column 2
etc …
Example ( list with a Dataset ) :
<t:listbody data="MYDATASET" height="240" indexbase="100" >
<t:listrow >
<t:listcell > <t:out v="@{#count}"/> </t:listcell>
<t:listcell > <t:out v="@{#index,??,'0000'}"/> </t:listcell>
<t:listcell > <t:out v="@{1,???}"/> </t:listcell>
<t:listcell > <t:out v="@{2,??,'000'}"/> </t:listcell>
<t:listcell > <t:out v="@{.3,??,'0000.00'}"/> </t:listcell>
<t:listcell > <t:out v="@{.4,??,'Yes|No'}"/> </t:listcell>
</t:listrow >
</t:listbody >
Telosys 6
Symbolic variables - Default value
If the symbolic variable is not found
If there is a default value : it is used
Else : a void string is returned ( "" )
The default value is located at the 2nd position
examples :
@{myint,123} "123" if not found
@{myint,123,000000} "123" if not found
@{mystr,'bla bla'} "bla bla" if not found
@{mystr,bla bla} likewise (the quotes are optional)
When the default value is used, it is returned
"as is", the format is not applied on a default value
@{mydate,,'yyyy-MM-dd'} "2008-03-30"
@{mydate,,yyyy-MM-dd} likewise
(the quotes are optional)
Without format, the "toString" method of the
object is used
The format is not applied on the default value
Telosys 7
Symbolic variables - Format
Boolean object format :
Without format boolean returns "true" or "false"
Format syntax : "value-if-true|value-if-false"
examples :
@{mybool,,Yes|No}
@{mybool,,Black|White}
@{mybool,,1|0}
Number object format
(Integer, Long, Double, BigDecimal, BigInteger, … )
If the format contains "|"
See
the "java.text.ChoiceFormat" is used
the
Else java
the "java.text.DecimalFormat" is used doc
Date object format
The "java.text.SimpleDateFormat" is used
Telosys framework - Symbolic variables ( Laurent Guérin ) 15
Use cases
Telosys 8
Use cases
Print a bean attributes :
<table>
<tr><td>Code</td><td><t:out v="code @{agency1.code,,'c000'}" /></td></tr>
<tr><td>Name</td><td><t:out v="name @{agency1.name}" /> </td></tr>
<tr><td>City</td><td><t:out v="city @{agency1.city,NO CITY}"/> </td></tr>
</table>
Use cases
Iterate on a list :
<table>
<t:iterate list="mylist" scope="session" indexbase="100" >
<tr>
<td> <t:out v="@{#count,,000}" /> </td>
<td> <t:out v="@{#index,,'idx-00'}" /> </td>
<td> <t:out v="@{.code,???,000}" /> </td>
<td> <t:out v="@{.city,'no city'}" /> </td>
<td> <t:out v="@{.phone,'???'}" /> </td>
</tr>
</t:iterate>
</table>
Telosys 9
Use cases
Populate combo box items from a list of beans :
<t:combobox id="ag1" x="80" y="40" value="2" >
<t:comboitems list="mylist" id="agency_item" cl="myclass"
style="color:red" title="The title @{#count}"
value="@{.code}"
txt="@{.code} - @{.name} (@{#count})(@{#index})"/>
</t:combobox>
THE END
Telosys 10