高级自定义 > Info*Engine User's Guide (《Info*Engine 用户指南》) > Info*Engine JSP Pages > Success and Failure Processing for Webjects
  
Success and Failure Processing for Webjects
Info*Engine provides the following set of custom tags that you can use to group the execution of webjects and provide success and failure processing:
unit
init
success
failure
These tags are supported in JSPs, but their use is strongly discouraged from within JSPs due to how a taglib must be processed. Ideally these tags should only be used from Info*Engine tasks.
For example, the following JSP page has the main body of a unit create one group and then execute three queries concurrently, one of which replaces the first group created. In the success block, it creates a group named “success”. In the failure block, it creates a group named “failure”. In either success or failure, it displays the XML of the last group created:
<%@page language="java"  session="false"
  errorPage="../IEError.jsp"%>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>

<%response.setContentType ("text/xml");%>

<ie:unit>

  <ie:webject name="Create-Group" type="GRP">
    <ie:param name="ELEMENT"    data="dbOut2=out"/>
    <ie:param name="DELIMITER"  data=":"/>
    <ie:param name="GROUP_OUT"  data="dbOut2"/>
  </ie:webject>

<ie:parallel>

  <ie:webject name="Query-Objects" type="OBJ">
    <ie:param name="INSTANCE"  data="jdbcAdapter"/>
    <ie:param name="CLASS"     data="EMP"/>
    <ie:param name="DBUSER"    data="jdm"/>
    <ie:param name="PASSWD"    data="jdm"/>
    <ie:param name="WHERE"     data="ENAME='SMITH'"/>
    <ie:param name="GROUP_OUT" data="dbOut1"/>
  </ie:webject>

  <ie:webject name="Query-Objects" type="OBJ">
    <ie:param name="INSTANCE" data="jdbcAdapter"/>
    <ie:param name="CLASS"    data="EMP"/>
    <ie:param name="DBUSER"   data="jdm"/>
    <ie:param name="PASSWD"   data="jdm"/>
    <ie:param name="WHERE"    data="ENAME='SMITH'"/>
    <ie:param name="GROUP_OUT" data="dbOut2"/>
  </ie:webject>

  <ie:webject name="Query-Objects" type="OBJ">
    <ie:param name="INSTANCE" data="jdbcAdapter"/>
    <ie:param name="CLASS"    data="EMP"/>
    <ie:param name="DBUSER"   data="jdm"/>
    <ie:param name="PASSWD"   data="jdm"/>
    <ie:param name="WHERE"    data="ENAME='SMITH'"/>
    <ie:param name="GROUP_OUT" data="dbOut3"/>
  </ie:webject>

  </ie:parallel>

  <ie:success>

    <ie:webject name="Create-Group" type="GRP">
      <ie:param name="ELEMENT"    data="SUCCESS=success"/>
      <ie:param name="DELIMITER"  data=":"/>
      <ie:param name="GROUP_OUT"  data="success"/>
    </ie:webject>

    <ie:webject name="Object-XML" type="DSP"/>

  </ie:success>

  <ie:failure>

    <ie:webject name="Create-Group" type="GRP">
      <ie:param name="ELEMENT"    data="FAILURE=failure"/>
      <ie:param name="DELIMITER"  data=":"/>
      <ie:param name="GROUP_OUT"  data="failure"/>
    </ie:webject>

    <ie:webject name="Object-XML" type="DSP"/>

  </ie:failure>

</ie:unit>
For the details on the custom tags used, see the tag descriptions in the Info*Engine Custom Tag Reference.