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
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.