Built-in nodes
- Declarations This code area should be used to declare any static variables or instance variables that a Servlet may need. Any Java statement which is legal to exist within the outermost scope of a Java class can be added here.
- Constructor This code area should be used for any additional initialization code that a Servlet may need. Any legal Java statements may be placed here. This code will be appended to the class constructor. Servlets rarely use this method because the init method is much more useful.
- init This code area should be used to perform any setup a Servlet may need to perform to become active. In the final product, the init method will be called on when the Servlet container first loads a Servlet and when the container decides that a Servlet needs to be re-initialized. Inside of the Enterprise Composer, you have control over when the init method is called instead of the server. When an Enterprise Servlet is first loaded into the Enterprise Composer window by opening it in the Simplicity IDE window, the declarations are processed and the init method is executed automatically. From that point on, any time that you want to re-initialize the servlet, you may select the Initialize Selected EnterpriseServlet menu item to re-process the Declarations, re-parse the User Methods, and re-run the init method.
- Modules This is a special node where Modules from the palette may be dropped. This is the only node under the Servlet node where Modules may be dropped. Modules provide units of business logic that are designed to accomplish various tasks. Each module has sub nodes that can be used to configure them to accomplish the corresponding task in the way that you want them to. Modules can add code to all of the major code areas of a servlet, though most of them add most of their code to the primary method. Modules are incorporated into your Servlet code in the order that they appear inside the Modules node. Correspondingly, they are executed in that order when the various parts of the Servlet are executed.
- Error Handler The Error Handler provides a way to enter code into a custom method called errorHandler that Simplicity Enterprise uses to provide a single unified area for processing errors in Module code. Each module is wrapped in a try catch block. This provides isolation between the code in the Modules and allows any errors or exception thrown by the modules to be captured and routed to the handler methods. When an Enterprise Servlet is first created, there is some default code in the Exception and Error Handlers that will simply print out basic error or exception information to the console window. However, it is recommended that you replace this code with code that will take appropriate action when Errors occur in your code. You can use the information in the variables err, moduleName, methodName, comment and registry to determine where the Error occurred. It is recommended that Errors use the httpServlet method call, sendError, to send an error back to the client. It is also recommended that all modules do not have their Continue On Error check box checked unless you have some specific reason for continuing your servlet if an Error occurs.
- Exception Handler The Exception Handler node provides the same service for Exceptions that the Error Handler provides for Errors. The only difference is that the variables that are available have the Exception object ex available instead of the Error object err. Also the default behavior for modules is to continue on Exception.
- User Methods This code area should be used to declare any static methods or instance methods that a Servlet may need.
- destroy This code area should be used to perform any operations needed before a Servlet is stopped, like releasing resources or saving preferences. This code will be the destroy() method of the Servlet.
| Data Representations, Inc. http://www.datarepresentations.com support@datarepresentations.com sales@datarepresentations.com |