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
NCEE_AndrewNCEE_Andrew 

URLs and Calling Class Functions

I'm trying to get a value from the URL and pass it to my Apex class.  Here's the URL

URL: https://c.na4.visual.force.com/apex/email?comment_id=Comment-0000003

Here's some sudo code for what I want to do

Visualforce:
Code:
<apex:page ...>
... {!myClass.URL($Request.comment_id)} ...
</apex:page>

Apex Class:
Code:
public class myClass
{
   private String comment_id = null;

   public void URL(String data)
   {
      this.comment_id = data;
   }

}


I want the VisualForce page to envoke the URL function and send it the comment_id value from the URL.  I know this doesn't work.  Why doesn't it work and what do I need to do to get it to work.
 

 

werewolfwerewolf
Is there a controller behind your Visualforce page?  There should be.  The controller can access the querystring of the URL directly via ApexPages.currentPage().  There's even an example called "Getting Query String Parameters" in the Apex Language docs under the PageReference class.  From the controller you can pass whatever you need to your Apex class (or you can just do whatever you wanted to do in the controller).
NCEE_AndrewNCEE_Andrew
Is there a list of attributes for the "ApexPages" function?  If so, what is the link so I can reference it?
werewolfwerewolf
Yes, it's in the Visualforce docs:

http://www.salesforce.com/us/developer/docs/pages/Content/apex_methods_system_apexpages.htm?SearchType=Stem