XAgent

<?xml version="1.0" encoding="UTF-8"?>
<!-- XPage which is not rendered but returns data like XML, JSON, etc.     -->
<!-- More: http://www.wissel.net/blog/d6plinks/shwl-7mgfbn                 -->

<xp:view xmlns:xp="http://www.ibm.com/xsp/core" rendered="false">
	<xp:this.afterRenderResponse><![CDATA[#{javascript:
 
var externalContext = facesContext.getExternalContext();
var writer = facesContext.getResponseWriter();
var response = externalContext.getResponse();
 
// set content type, e.g. ...
response.setContentType("text/xml");
// response.setContentType("application/json"); 

response.setHeader("Cache-Control", "no-cache");
 
// read parameters, e.g. ...
var param = context.getUrlParameter("myParam");
 
// write HTML output e.g. ...
writer.write("<br></br>");
// writer.write("{'jsonvar'='jsonvalue'}"); 

writer.endDocument();
}]]>
	</xp:this.afterRenderResponse>
</xp:view>





Empty XAgent sample

XPages
Stephan Wissel
November 15, 2011 5:42 AM
Rating
851

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



2 comment(s)Login first to comment...
Serdar Basegmez
(at 05:17 on 14.02.2012)
I did a second test...
Niklas Heidloff
(at 05:15 on 14.02.2012)
testing comments