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
tmax8200tmax8200 

Receiving URL parameters

Hi,

 

I am having difficulty immediately storing a parameter passed through a URL.

 

Here's the VF:

<input type="hidden" name="key" value="{!uniqueID}"/>

 

Here's the controller:

Public String uniqueID = System.currentPagereference().getParameters().get('q');

 

Here's the URL:

xxx.visual.force.com/apex/sendfilepage?q=xxx

 

Here's the error:

Unknown property 'sendFileController.UniqueID

 

The case is I am sending a file to amazon s3 online storage using a POST request and the URL parameter is the name of the file. This error persists until I write Public String uniqueID {get; set;} at which point I get a visualforce error saying I have two objects with the same name. It compiles when I comment out the original uniqueID. Any idea how to get around this without setting uniqueID within a new method? Or how to run a method immediately upon page loading?

 

Thanks!


Max

Best Answer chosen by Admin (Salesforce Developers) 
jeremyyjeremyy

uniqueID needs to be a property in order for a VF page to access it. You could just add an accessor:

 

 

public String getUniqueID() {
    return uniqueID;
}

 

 

All Answers

jeremyyjeremyy

uniqueID needs to be a property in order for a VF page to access it. You could just add an accessor:

 

 

public String getUniqueID() {
    return uniqueID;
}

 

 

This was selected as the best answer
tmax8200tmax8200

Thanks, that worked perfectly. I was wondering if you could possibly answer another question. I'm trying to pass a parameter through the URL of a page doing a POST request. The parameter is the name of a file I'm uploading to s3. I was hoping this would work    <input name="file" type="file" fileName="{!fileName}"/>  but the parameter comes up blank on the next page.