IBM Version 5 Universal Remote User Manual


 
268 The XML Files: Development of XML/XSL Applications Using WebSphere Studio
Modifying the doPost method
Now we need to modify the doPost method. All we need is to invoke is the
doRegister method with HttpServletRequest. Once the doRegister succeeds, go
showpage to show results. If it fails, go back to the input form, which will be
reproduced by the doGet method. The doGet method reuses the XML Document
that is currently instantiated in the servlet instance, and the membership field has
been replaced with
-1 message.
Example 11-4 CustomerXSLServlet doPost method
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
if( doRegister(request) == true){
showPage(resultStylesheet, response );
}else{
doGet(request, response);
}
}
If the membership already exists, Customer.xsl will be told as the membership is
-1. To handle this to the meaning message, we used xsl:if tag.
Example 11-5 The xsl:if tag
<td>membership
<xsl:if test = "$membr = -1" >
*
</xsl:if>
:</td>
In this case, add * next to the membership. Or, use this tag to show Membership
is already exist in the input field, or message area.