
}
catch (Exception ex)
{
PrintWriter pw = response.getWriter(); pw.println("<html><body><h2>Transformation Error</h2><pre>"); ex.printStackTrace(pw); pw.println("</pre></body></html>");
}
}
Modifying the doGet method
Regarding the above modification, doGet must be changed to set document.
Example 11-11 showPage method
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
try{
showPage(mainStylesheet, response, getCustomerXML().produceDOMDocument());
}catch(Exception e){ System.out.println(e);
}
}
Modifying the XSL file
Since our main HTML is a dynamic thing, we can modify the transformation file to add Query Button to the main form (Figure
Example 11-12 Customer.XSL membership template
<xsl:template match="membership">
<xsl:variable name="num">
</xsl:variable>
<tr> <td>Membership: </td>
<td><input name="memberhsip" type="text" size="20" maxlength="40" value="{$num}"/>
<input type="submit" name="queryBtn" value="Query"/> </td>
</tr>
274 The XML Files: Development of XML/XSL Applications Using WebSphere Studio