Displaying content from Java External
Options
I'm trying to create a Java external to be used in a component. I want the helloElement attribute value and the text displayed in the component.
Here is my Java Code (it's a quite simple example):
package com.sayHello; import com.interwoven.livesite.dom4j.Dom4jUtils; import com.interwoven.livesite.runtime.RequestContext; import org.dom4j.Document; import org.dom4j.DocumentHelper; import org.dom4j.Element; public class HelloTeamsite { public static Document hello(RequestContext context) { Document doc = Dom4jUtils.newDocument(); Element docElement = DocumentHelper.createElement("helloElement"); docElement.addAttribute("isPolite", "Java is polite and is saying hello."); docElement.addText("Java is still trying to say hello."); doc.add(docElement); return doc; } }
While creating my custom component, my Content XML data is:
<Data> <External> <Object Scope="local">com.sayHello.HelloTeamsite</Object> <Method>hello</Method> </External> </Data>
When I preview the component, I notice that my hello method is called correctly and data is retrieved, as the Content XML area during the preview displays the "Java is still trying to say hello." message. The problem is that I can't present the data. I'm guessing something is wrong with my Appearance code:
<!DOCTYPE html-entities SYSTEM "http://www.interwoven.com/livesite/xsl/xsl-html.dtd"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Skin: Default (Default Browser Type) --> <div> <xsl:value-of select=”/Properties/Data/Results/helloElement”/> </div> </xsl:stylesheet>
Other trial and error attempts include:
<!DOCTYPE html-entities SYSTEM "http://www.interwoven.com/livesite/xsl/xsl-html.dtd"> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Skin: Default (Default Browser Type) --> <xsl:template match="/"> <div> <xsl:apply-templates select="/Properties/Data/Result/helloElement" /> </div> </xsl:template> <xsl:template match="helloElement"> <div> <h2> <xsl:value-of select="isPolite" disable-output-escaping="yes"/> </h2> </div> </xsl:template> </xsl:stylesheet>
Any help is appreciated.
0
Comments
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 123 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
TeamSite Developer Resources
If you are interested in gaining full access to the content, you can register for a My Support account here.
- Docker Automation
- LiveSite Content Services (LSCS) REST API
- Single Page Application (SPA) Modules
- TeamSite Add-ons
If you are interested in gaining full access to the content, you can register for a My Support account here.