Home > Contents > Index >
Expanded TOC | Accordion TOC | Annotated TOC | Index
Seed.Execute
This method is invoked as a result of the
CALLJAVAor a custom tag.Syntax
public String Execute(FTValList vIn, FTValList vOut)Parameters
vIn- Input parameter. List of name/value pairs that appear as
ARGUMENTtags in theCALLJAVAtag, or as attributes set in the custom tag.
vOut- Output parameter. List of name/value pairs that will appear as variables in the XML element upon return from the
CALLJAVAtag. This is ignored when the method is called via a custom tag.
Description
When an XML element calls the
CALLJAVAtag or calls a custom tag, Sites invokes theSeed.Executemethod. The way this method behaves depends on whether it was triggered byCALLJAVAor by a custom tag.Invoking the Seed Interface with CALLJAVA
When the
Seedinterface is invoked directly withCALLJAVA:
- The class implementing the
Seedinterface is instantiated every time it is called. This allows the implementing class to be written in a non-reentrant way. This can impact performance negatively, since the class is instantiated every time.
- Values are passed back to the calling Sites context by setting the value in the
vOut FTValList. Elements of theFTValListare then turned into variables upon return from theCALLJAVAtag.
- There is no way to obtain a reference to the calling ICS context, so there is no way to access any of the Sites servlets.
- As a direct consequence of the previous point, there is no way to pass any complex values between the class and Sites. In particular, Sites lists cannot be accessed from the class, and lists created by the class cannot be returned to the Sites context.
Invoking the Seed Interface with a Custom Tag
When the
Seedinterface is invoked with a custom tag:
- The class implementing the Seed interface is instantiated only once. This requires that the class be completely re-entrant.
- Values that may be put into the
vOut FTValListare not converted to variables. Variables are set using the Sites servlet.
- The following three parameters are added to the
vIn FTValListby Sites when the custom tag is invoked:
_ICS: This is an ICS value that can be cast to an ICS object. This ICS object provides the Sites context, which allows access to the servlets provided by Sites._TAGNAME: the custom tag name used to invoke the class._CDATA: all the text found between the begin tag and the end custom tag.- ICS methods are used to pass values between Sites and the class. The types of values handled include variables, session variables, properties, counters, and lists.
- The class and all classes it invokes must be fully re-entrant.
Returns
A string that will be inserted into the output stream at the position of the
CALLJAVAtag. Null or empty strings are valid. If invoked via a custom tag, this string will be appended to any other output that may be streamed back by calls to Sites servlets, for example, byStreamEvalBytes().Example
The following example illustrates the use of
Seedcalled from a custom tag:import java.util.*; import java.net.*; import java.io.*; import java.text.*; import COM.FutureTense.XML.Template.Seed; import COM.FutureTense.Interfaces.FTValList; import COM.FutureTense.Interfaces.FTVAL; import COM.FutureTense.Interfaces.ICS; /** ** This sample class just gets the Sites context and ** returns the tagname by which it was called in the variable ** tagname. **/ public class Example implements Seed { public Example() { // As a check that the class is getting created.. // System.out.println("Example created."); } public String Execute(FTValList vIn, FTValList vOut) { ICS cs = null; String output = ""; try { FTVAL obj = vIn.getVal("_ICS"); cs = (ICS) obj.GetObj(); String sTag = vIn.getValString("_TAGNAME"); cs.SetVar("tagname", sTag); } catch { System.out.println("Example exception: " + e.getMessage()); } return output; } }
Home > Contents > Index > ![]()
Oracle JAVA Reference
Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.