Portlet Factory, Version 6.1.2
Linked Java Object builder
The Linked Java Object builder adds the public methods of a Java class to the web application.
You can use the Linked Java Object builder to incorporate existing Java code or you can create new Java classes to be used with Linked Java Object builder calls to consolidate commonly used methods into a single, easily re-used Java class.
Quick tips
- Provide your methods with access to the current webAppAccess object
- You can provide the methods in your LJOs with access to the current webAppAccess object by declaring that those methods take at least one argument of type WebAppAccess. For example,
public IXml getCustomers(WebAppAccess myWebApp) {...}Note: Do not store the WebAppAccess object as a member variable because it can become stale as LJOs remain instantiated throughout the execution of the Web application.
- Simplifying linked Java object method calls
- Set the Model Method Base input to Use this Linked Java Object's class as a base for all methods in model.
Using this naming convention allows you to call methods in the Linked Java Object with webAppAccess.callMethod("MethodName"); instead of webAppAccess.callMethod("LJOName.MethodName");.
- Persisting linked Java objects during failover
- LJOs persist during a failover event if the underlying Java class implements the Serializable interface.
- Avoid overloading methods in linked Java objects
- If you are creating Java source files to be used as linked Java objects, create unique methods instead of overloading one method. Doing so ensures predictable behavior and makes choosing those methods easier when you use the data picker or various select boxes for assigning actions to controls.
To use overloaded methods in your linked Java object, try to write them all before you add the linked Java object to your model. Then builder calls can invoke the correct method. If you do need to overload methods after adding the linked Java object to your model, examine each builder call that calls a variation of the overloaded method and confirm that it is calling the appropriate method.
Parent topic: Builder help
- About using the builder call editor
The builder call editor allows you to specify all the input values to a builder call.
- Linked Java Object builder inputs
This topic describes the inputs for the Linked Java Object builder.
- Calling other methods and model actions from an LJO
This topic provides examples of the syntax you can use to call other methods or actions in a model.
- Overview: working with Java
IBM® WebSphere Portlet Factory applications rely on Java for all their application logic.
- Overview: working with XML
When you develop J2EE applications with IBM WebSphere Portlet Factory, much of the underlying technology relies on XML.
- Passing arguments to actions
The Input Mappings group allows you to specify argument names and values to pass to an action.
- Advanced error handling techniques
If the method calls within the Java-based method have an error handler, the lower-level handler, which is the handler in the method calls that are contained in the Java-based method, is called.
- WebSphere Portlet Factory API documentation
Library | Support |