OpenWGA 7.7 - TMLScript reference

WGA
Method :

javaObject(jsObject)

On object WGA
Usage Converts a JavaScript object to the corresponding Java object, making its Java methods accessable
Description

This can be used on any native JavaScript object that has a Java pendant, like Strings, Numbers etc.

For backward compatibility there still is a global function "javaObject()" available whose use is discouraged since OpenWGA 5.3.

Parameters jsObject:
JavaScript object to convert
Return value The java object pendant of the given JavaScript object
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
    portletevent
Examples This example converts a JavaScript string to a Java string in order to call its trim() method which is not available on the JS object. The returned string is again a JavaScript string as TMLScript automatically converts all output objects of Java methods to their JavaScript pendants:

WGA.javaObject("some untrimmed String ").trim()