開発者は、開発者サンドボックスで Visualforce ページを作成してテストしましたが、本番環境で使用するときにビューステートエラーが発生したというレポートを受け取りました。
開発者はこれらのエラーを修正するために何を確認する必要がありますか?
正解:C
The developer should ensure variables are marked as transient to correct the view state errors. The transient keyword is used to mark a variable as transient, which means that the variable is not part of the view state, and it is not persisted or transferred between the server and the client. The developer should use the transient keyword for variables that are used for temporary storage or calculations, and that do not need to be retained across postbacks. This way, the developer can reduce the size of the view state, and avoid exceeding the view state limit. Ensuring queries do not exceed governor limits will not help, as it will only avoid hitting the SOQL query limit, but it will not reduce the size of the view state. Ensuring properties are marked as private will not help, as it will only limit the access to the properties, but it will not reduce the size of the view state. Ensuring profiles have access to the Visualforce page will not help, as it will only grant the permissions to view the page, but it will not reduce the size of the view state. Reference: [transient Keyword], [Visualforce View State], [Visualforce Developer Guide]