Panel text output without markup – XPage notetoself
Sometimes you might want an easy way of changing the text of a panel in design view of a XPage and to output it without any markup i.e. the panel contains the text “Hello World!” and all you want to output to the client is “Hello World!”.
You could use this technique and add your own markup surrounding the panel text of course. That’s the whole reason of this post. I’ve found out a way to do this without disabling themes and such.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xp:view rendered="false" xmlns:xp="http://www.ibm.com/xsp/core">
<xp:this.afterrenderresponse>
<![CDATA[#{javascript:var writer = facesContext.getResponseWriter();
var control:javax.faces.component.UIComponent = getComponent("panel1");
var out = "";
var children = control.getChildren();
for (child in children) {
if(child.getClass() === com.ibm.xsp.component.UIPassThroughText)
out+=child.getText();
else
out+=child.getClass();
}
writer.write(out);
}]]>
</xp:this.afterrenderresponse>
<xp:panel id="panel1">Hello World!</xp:panel>
</xp:view>





















