I have a commandLink in a table that calls a method in the apex controller when clicked. I want it to open the page that has been assigned in the pageReference but instead its loading the same page and when I hover over the href is not showing the right page I have tried couple of different approach but none of them works.
the below VF code is residing on the Main.vfc and when the user clicks on the hyperlink I want the user to redirect to NewEmployee.vfc page.
<apex:commandLink value="{!e.Name}" action="{!clickOnName}">
<apex:param name="eId"
value="{!e.Id}"
assignTo="{!empId}"/>
</apex:commandLink>
Controller:
public Id empId{get; set;}
public PageReference clickOnName()
{
system.debug('clickOnName//' );
//PageReference newPage = new PageReference('/' + Page.NewEmployee);//this did not work as well.
PageReference newPage = Page.NewEmployee;
newPage.getParameters().put('empId', empId);
return newPage.setRedirect(true);
}
Also I do not see the debug message when I click on the hyperlink meaning that this action method never calls that