function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Pagereference by visualforce page without Call Controller

Hi friends,

Is it possible to refresh a page from visualforce page witout calling an Apex Class. 

1. I saved one record from visualforce page, Now Record's are saved successfully. 
2. And still data's are enabled in relevant fields after records are saved.
3. Right Now i am using finally, it's Working wonderfully.
finally {
attachment = New Attachment();
4. And Now I want to refresh a page from visualforce Page itself without calling an apex Class / Controller.

********Sample Apex********
public with sharing class AttachmentUploadController {

    public AttachmentUploadController(){
    Public Attachment attachment{
            if(attachment == Null){
                attachment = New Attachment();
            return attachment;
    Public Pagereference upload(){
        attachment.OwnerId = userInfo.getUserId();
        attachment.ParentId = ApexPages.currentPage().getParameters().get('Id');
        attachment.IsPrivate = False;
        Insert attachment;
        }Catch(DMLException e){
            ApexPages.addMessage(New ApexPages.message(ApexPages.Severity.ERROR,'Error uploading attachment'));
            return Null;   
            attachment = New Attachment();   // Solved By Using Finally ....
        ApexPages.addMessage(New ApexPages.message(ApexPages.Severity.CONFIRM, 'Attachment uploaded successfully'));    
        //attachment = New Attachment();
        return Null;


*********** Sample VF Page  *************

Thanks In Advance.