2

In an apex controller constructor I have set a value in a static variable (say VerificationCode). In the VFP button click action, I am invoking the registerUser method (non-static method), in the same method how can I access the VerificationCode static variable?

<apex:commandButton id="confBtn" action="{!registerUser}" value="Save and next"/>

Thanks in advance.

1 Answer 1

2

Your registerUser method can access the static variable ... statically.

ie:

public class YourControllerClassName
public static String verificationCode;

PageReference registerUser(){
  String code = YourControllerClassName.verificationCode;
  //more stuff...

}

You must log in to answer this question.

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