IBM Version 5 Universal Remote User Manual


 
Chapter 11. Light weight XML-based Enterprise Application 269
Figure 11-7 The doPost method
Adding the error case
In the error case, we need to set back the data that was originally posted from the
browser. Unless this functions, all user typed information has been cleared when
the error occurred. To bring back the data to the browser, we need to modify the
template. The original value attribute of the input tag is blank. To set back with the
value that was previously typed (the XML data contains that data), use variable
{$fname} in the value attribute. To set this variable, use xsl:variable tag and use
the value of the current position. You need this modification to all fields.
Example 11-6 Customer.XSL firstname template
<xsl:template match="firstname">
<xsl:variable name="fname">
<xsl:value-of select="."/>
</xsl:variable>
<tr>
<td>Firstname: </td>
<td><input name="firstname" type="text" size="20" maxlength="40"
value="{$fname}"/></td>
</tr>
HTML
HTML
XMLToSQL
doGet
Customer XSL
Customer
Result XSL
XSLT
Processor
XSL Servlet
doPost
XML Data
-Firstname
-Lastname
-email
-membership
error case
normal case