Advanced Customization > Info*Engine User’s Guide > Info*Engine Custom Tag Reference > Info*Engine Tags > Core Library Tags > getService
  
getService
The getService tag establishes a variable reference to the Info*Engine object (com.infoengine.jsp.InfoEngine) that is being used by the Info*Engine custom tags on a JSP page.
After you define the variable, you can use it in code that uses methods from the Info*Engine Server Access Kit (SAK). For example, you can access VDB information, retrieve groups, format rows and columns, and so on.
This tag also establishes implicit variable references for the context groups in use by tags within the page (com.infoengine.object.factory.Group). The variables instantiated are:
formGroup
Contains attributes that are obtained from the CGI query specification data that is received with the URL used to access the template. It also contains any HTML form data that was received as the result of a web browser POST request. This is the same information stored in the FORM context group.
serverGroup
Contains attributes that are derived from the protocol used to communicate from the web browser to the web server. It can contain values such as accept-language or auth-user. Refer to the current web-browser-to-web-server protocol specification to find more information on the individual attributes found in this group. This is the same information stored in the SERVER context group.
cookieGroup
Contains one element that has an attribute for each cookie that is processed during the connection to the JSP page. This is the same information stored in the COOKIE context group.
authGroup
Contains attributes that provide a credentials map for the task in which the webject executes. The map contains authentication information used by adapters in establishing connections to back-end information systems. Each element of a credentials map provides a username and associated credentials that are used in connecting to a specific back-end system. This is the same information stored in the Auth-Map context group.
* 
Only use this tag on JSP pages; do not use it in standalone Info*Engine tasks.
Each page can only have one getService tag on it.
This tag cannot be embedded within other Info*Engine tags.
Syntax
<ie:getService varName="variable_name"/>
Attribute Descriptions
Required Attributes: varName
varName
Specifies a Java variable name for the Info*Engine object. This tag defines the variable; you do not need to define it before specifying the name here.
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine core tag library and that the tags have the ie prefix. The example creates the “EMPLOYEEdata” group through a query and then displays the number of rows in the group. To get the number of rows, the example uses the getService tag to identify the service as “ieObj” and then uses the getElementCount method from com.infoengine.object.factory.Group class to retrieve the number of rows:
<%@page language="java" session="true" errorPage="../IEError.jsp"%>

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

<!-- perform a query -->
<ie:webject name="Query-Objects" type="OBJ">
<ie:param name="INSTANCE" data="com.myCompany.jdbcAdapter"/>
<ie:param name="CLASS" data="EMP"/>
<ie:param name="WHERE" data="()"/>
<ie:param name="GROUP_OUT" data="EMPLOYEEdata"/>
</ie:webject>

<!-- display how many elements were returned -->
<ie:getService varName="ieObj"/>
<P>Search returned
<b><%=ieObj.getElementCount()%> employees. employees.>
</body>
</html>