I have VF page with Standard Controller and extension. I have declared one variable as transient with getter and setter. VF page has input tag where I am allowing user to input transient varible value. But after clicking on submit button, I am getting NULL value of transient variable in apex method. How i can access transient variable value in apex which entered from VF page

1 Answer 1


You can't. That is the entire point of the transient keyword; the value will not be transmitted in the view state:

Use the transient keyword to declare instance variables that can't be saved, and shouldn't be transmitted as part of the view state for a Visualforce page. For example:

Transient Integer currentTotal;

You can also use the transient keyword in Apex classes that are serializable, namely in controllers, controller extensions, or classes that implement the Batchable or Schedulable interface. In addition, you can use transient in classes that define the types of fields declared in the serializable classes.

Declaring variables as transient reduces view state size. A common use case for the transient keyword is a field on a Visualforce page that is needed only for the duration of a page request, but should not be part of the page's view state and would use too many system resources to be recomputed many times during a request.

If you want a value to be captured on the front end, remove the transient keyword. Any value which can be captured in an input will not bloat your view state enough to justify any other solution.


You must log in to answer this question.

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