Info*Engine Tasks
The following topics introduce the concept of an Info*Engine task, describe how to create and use tasks, and describe the XML output that Info*Engine produces when displaying groups.
About Info*Engine Tasks and Task Rules
Info*Engine text-based documents are called “standalone tasks,” and can control the retrieval and manipulation of data within your Info*Engine environment. Instead of using a custom Java application or JSP pages to perform all operations on the data (including retrieving and displaying your data), you can separate out the data retrieval and manipulation operations from the display operations using tasks.
One of the advantages of using tasks is that you can organize your code so that data operations can be done once and then used many times. The Info*Engine task compiler parses Info*Engine tasks and produces executable Java classes from them. This improves the performance of executing Info*Engine tasks by eliminating the need to parse and interpret a task each time it is called. It also facilitates embedding Info*Engine tasks in standalone Java applications and JSP pages.
The task compiler produces the executable Java classes in three basic steps:
1. It parses the source of a task and generates Java source code that implements the task.
2. It calls a Java compiler to produce an executable class from the generated Java source.
3. It calls a class loader to load and instantiate the classes produced by the Java compiler.
As a performance optimization, the task compiler retains compiled classes in a cache and avoids the first two steps whenever it can determine that a cached class is up to date. A cached class is discarded and regenerated whenever the compiler discovers that the task has been updated since the last time that the task was compiled.
* 
Due to the upgrade to the latest JSP specification, JSPs using Info*Engine substitution syntax can no longer use the ${...} syntax. Info*Engine now supports an alternate syntax, $(...) that must be used instead.
All Info*Engine tasks function with either syntax of $(...) or ${...}. Preexisting tasks continue to function as is and do not have to be changed.
Preexisting JSPs must be updated to use the new $(...) syntax or they fail to compile and do not function as expected.
Specific Task Rules
When creating tasks, you must adhere to the following rules:
An Info*Engine task should start with a JSP page directive similar to the following:
<%@page language="java" session="false"%>
The import attribute on the page directive should also be included if additional classes are required.
The task must specify the custom tag library used in the file. Info*Engine has three custom libraries: core, directory, and supplied libraries; only the core library and the supplied libraries are supported in tasks. To identify the library, include taglib directives similar to the following:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>
* 
You must specify the uri attribute value exactly as it is shown here. You can choose a different prefix value. However, you must use whatever value you specify as the prefix for the tags from the corresponding library.
The task must have at least one task webject. You use the webject and param tags to specify the webject.
Tasks cannot contain any display elements such as display webjects. If HTML tags are in a task, they are ignored.
General Task Rules
To be well-formed and valid, the Info*Engine task must follow these basic rules:
For Info*Engine custom tags and JSP tags, you must use lowercase. For example, you must specify the webject tag as “webject” and not “WEBJECT” or “Webject” or even “webJecT”.
You can use comments to document what is happening in your task or to cause the complier to skip a section of the task. If a webject is surrounded by a comment, it is not executed. Comments can be located anywhere in a task except within tags, declarations, or other comments.
Comments begin with <!-- and end with -->.
Empty elements must be properly constructed. The trailing /> characters (the forward slash followed by the right angle bracket) in the task syntax indicates to the task compiler that the element is empty and no matching end-tag should be sought. For example, the param custom tags make use of the empty element construction.
Additional general rules for using scriptlets, expressions, declarations, directives, and Info*Engine custom tag elements can be found in the Info*Engine Custom Tag Reference.
这对您有帮助吗?