I have 2 different apex:actionFunction, one is for save, the other is for saveAndNew:
<apex:form >
<apex:actionFunction name="save" action="{!save}" status="sub-status"/>
<apex:actionFunction name="saveandnew" action="{!saveAndNew}" status="sub-status"/>
</apex:form>
currently, I am using 2 controller methods to make them work, 'save' and 'saveAndNew'
public PageReference save(){
//save codes here
PageReference pageRef= new PageReference('/'+returnId);
pageRef.setRedirect(true)}
public PageReference saveAndNew(){
//the same save codes
PageReference pageRef = new PageReference('/apex/page2');
pageRef.setRedirect(true);
return pageRef;}
The problem is, both methods have the same line of codes for 'save' and the only difference is the returned page reference. How can I make this into one method? can I use apex:param? if so, how may I write it? I'm so stuck on this...