I am new to visualforce remoting no idea about it. I do not need a code or a lenghty explanation but pls tell me what is visualforce remoting and importantly how does it play an important role in reducing the view state in a visualforce page

  • are you talking about javascript remoting? – Santanu Boral Jan 14 '17 at 6:36
  • Hm I guess its that not sure like I want to reduce action tags using remoting. i think javascript remoting – Pooja Biswas Jan 14 '17 at 6:42
  • so you dont like to use @remoteAction then go for Visualforce Remote objects – Santanu Boral Jan 14 '17 at 6:44
  • 1
    its good for look into this: andyinthecloud.com/2014/01/22/… – Santanu Boral Jan 14 '17 at 6:52
  • what is @remoteAction, how it help reduce viewstate? – Pooja Biswas Jan 14 '17 at 7:01

In Visualforce, when you use apex: tags, each tag generates a server-side component (object) as the page is executed. That component tree eventually generates the HTML that is sent to the client. But (for pages that support editing) a serialised version of the component tree and the controller instance is also embedded in the HTML as a hidden field so that when a request is made back to the server the component tree and controller instance can be re-created to handle the request. This simplifies the code needed: the developer can just think about the problem as if the server-side state is always present.

But the view state can get very large (and can hit an upper limit where the page no longer works at all). As the view state gets large things slow down because of the overhead of transmitting the view state over the internet and the processing time required to serialize and deserialize it.

When using an @RemoteAction, you are opting out of this view state mechanism for the request. The server-side method has to be static meaning that it can't reference any fields of the controller and that it has to do all its processing from scratch. But the overhead of the view state is eliminated so the processing can proceed faster.

I suggest it only makes sense to introduce @RemoteAction processing where you have a specific need. For most Visualforce pages that handle limited amounts of data, the benefit you get will probably not be worth the extra complexity it introduces.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.