[SalesForce] getting Id in apex controller without using standard controller ApexPages.StandardController

I have one apex page IncForRep that rerefs a controller IncForRep. i have used
this constructor

public IncForRep(ApexPages.StandardController a){..} 

to use Id i=a.getRecord().get('id'); . I want to get the id from the URL of this page. https://c.cs7.visual.force.com/apex/IncForRep?RepId=005A0000001LvaqIAC in my method.

thanks in advance

Best Answer

you can use the below code to get the parameters from the URL

ApexPages.CurrentPage().getParameters().get('RepId');

UPDATE : based on the error message you posted, it seems you are having an extension controller instead of a custom controller.

for extension controllers you need to have ApexPages.StandardController as a parameter to the constructor.