Part III Fundamentals of Mobile Content
Miscellaneous Issues
•
Division by 0 will simply return false. No exception will be thrown
•
If an attribute is valid but is not an attribute of the device in question, a naming exception is
thrown
•
Java method calls will not be evaluated. A naming exception will be thrown
•
Short circuit logic applies. This means that if a syntax error has not been encountered before
the outcome of the statement has been determined, there will be no error. WebLogic Mobility
Server does not continue to evaluate a statement once a result has been established
Use "where" with Request Headers
In addition to using "where" expressions with Device Repository attributes, it is possible to use
"where" expressions with information from Request Headers.
This is done using the
getHeader('headerName')
"headername" is case-insensitive and allows any string.
Example
To include text if the Accept Header contains "gif", you could use the expression:
<mm-include where="find('gif',getHeader('accept'))'>Found Gif in accept
header</mm-include>
Note: getHeader returns "None" (the python version of null, not the string) if the requested header
is not present.
Alternatively,
getHeaderWithDefault('headerName','valueIfNotPresent')
This function will return the defined "valueIfNotPresent" if there is no header called
"headername" for this request.
Examples of "where" Usage
Example 1: Use of "where" with "and" Operator
Here's an example using a compound
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//MOBILEAWARE//DTD MMXHTML 1.2//EN"
"http://www.mobileaware.com/DTD/mmxhtml_1.2.dtd">
<html>
<head>
<title>Use of "and"</title>
</head>
<mm-structure id="include-and1" where="IsMenuDriven">
<mm-group-ref idref="message-include-and" type="normal" depth="flat"
display="all" />
</mm-structure>
<body>
<mm-group id="message-include-and" title="Message-include-and">
<mm-head id="message-head-include-and" useradded="yes">
MENU-DRIVEN DEVICE
</mm-head>
<mm-body idref="message-head-include-and" id="message-body-include-and">
<h1>Example 1</h1>
<mm-include where="DeviceName=='M3Gate0.6'and UsableWidthPixels ==120">
48 - BEA WebLogic Mobility Server User Guide
function in a "where" expression. The
condition that uses the "
where
can be used.
" operator.
and
Need help?
Do you have a question about the WebLogic and is the answer not in the manual?