The list view for an object is your base URL / the 3 letter prefix for your object / o, for example:
https://na1.salesforce.com/a0C/o
You can now go ahead and create an action which returns a Pagereference with an appropriate URL and set it to redirect (pr.setRedirect(true)).
Want to learn Salesforce from the scratch? Here's is the right video for you on Salesforce provided by Intellipaat:
Otherwise, you can use your controller as an extension to a standard controller, and just call cancel on the standard controller:
// controller extension
public class TimeSheetExtension
{
ApexPages.standardController m_sc = null;
public TimeSheetExtension(ApexPages.standardController sc)
{
m_sc = sc;
}
public PageReference doCancel()
{
return m_sc.cancel();
}
}
// page
<apex:commandButton action="{!doCancel}" value="Cancel"/>
Another thing is that this won't take you to the list view. Rather, it will return you to the last page which you were viewing before going to the VF page.
If you are preparing for the Salesforce admin certification exam, you can take up this Salesforce training by Intellipaat!