1

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

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

1 Answer 1

3

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .