开发者

I want to expose naked xml/json on VisualForce

开发者 https://www.devze.com 2023-03-14 00:15 出处:网络
I am trying to expose self generated XML (or JSON) from VisualForce. However I cannot find the way to override the parent pages on an apex:page component so I am getting the whole menu, bars and all h

I am trying to expose self generated XML (or JSON) from VisualForce. However I cannot find the way to override the parent pages on an apex:page component so I am getting the whole menu, bars and all he extra html around.

But I only want to serve the selfgenedated xml. Basical开发者_JAVA技巧ly I want to do this:

http://salesforceserverXX.com/apex/page ---->

content

Is that possible?


Yes it's possible. Below VF code output JSON string. Please note the showhedear and contentType parameter. ControllerClass is the apexclass hosting "processRequest" method which generates a JSON string "requestReponse"

<apex:page controller="ControllerClass"
    contentType="text/javascript"
    showHeader="false"
    cache="true"
    expires="1"
    action="{!processRequest}">{!requestResponse}</apex:page>


Yes, check out this discussion thread.

0

精彩评论

暂无评论...
验证码 换一张
取 消