JSF managed bean destroy object when navigating to a different mb
===

I have 2 jsf pages, each of them have a managed bean.
I'm navigating out of the second page to the first one , and want to destroy the entity object inside of it. my problem is that after i set it to null , It still going into the `getDetails` method which creates a new entity..

how can I prevent it from going to the `getDetails` method when exiting this page?
how can I destroy this entity correctly? am I doing somthing wrong?

This is my code:

    
    public class page2MB {
    
    @EJB
    private page2SessionBean page2SessionBean;
    private Page2 page2;
    
    public page2MB() {
    }
    
    public Page2 getDetails()
    {
        if(page2 == null)
        {
            Map requestParams = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();   
            page2 = new Page2();  
            page2.setPage2PK(new Page2PK(Short.parseShort((String)requestParams.get("param1")),
                                              Short.parseShort((String)requestParams.get("param2"))));            
            
            page2 = page2SessionBean.find(page2);    
        }        
        return page2;
    }
        
    public String exit() 
    {       
        try
        {
            page2 = null;
            return "page1";
        }
        catch(Exception exp)
        {                      
            exp.printStackTrace();
            return "";
        } 
        finally
        {
            
        }
    }    
    }

page2.xhtml:

    <f:view>
           <h:form>                              
                <h:panelGrid columns="2">                
					<h:inputText id="page2PKfield1" value="#{page2MB.details.page2PK.field1}"/>                                                                   
					<h:inputText id="page1MBfield1" value="#{page1MB.details.field1}"/>                                                   
                    <h:inputText id="page2MBfield2" value="#{page2MB.details.page2PK.field2}"/>                                            
                    <h:inputText id="field2Desc" value="#{page2MB.details.field2Desc}"/>                    
                </h:panelGrid>                                
                <h:commandButton id="exit"   value="יציאה" action="#{page2MB.exit}" immediate="true"></h:commandButton>                                     
            </h:form>
        </f:view>

Thank's In Advance.

