+ Start a Discussion
shivram survaseshivram survase 

how to store value permanently in apex controller

Hi,

I'm using same controller for 2 vf pages.The data entered on one vf page wanted to display on other vf page.
When I try to display data on other vf page getting NULL.I'm using <Apex:Actionfunction> for passing the passing the perameter
and calling the method defined in Controller.Also used Actionpoller to rerender the certain portion on vf page.

Help is appreciated in advance !

Here is the code..
---------- Controller method --------------------
 public void echoVal()
    {
     system.debug('After 30 Seconds==>'+enteredText1);
     val = 'You have entered :  - '+enteredText1;
     system.debug('Testing..parameter==>'+val);
    }  

-------------- VF page1 (getting data from user) ---------------------
  Enter SR_Description :
    <apex:inputText id="txt1" />
      <apex:outputPanel id="resultPanel">
        <b><apex:outputLabel value="{!val}" /> 
     </b></apex:outputPanel>
 <apex:actionFunction name="echo" action="{!echoVal}" reRender="resultPanel">
        <apex:param name="firstParam" assignTo="{!enteredText1}" value="" />
      </apex:actionFunction> 

    <apex:outputLabel rendered="{!uploadFlag}" value="{!uploadMessage}"></apex:outputLabel>
 <!-- <center><apex:commandButton value="Save" onclick="CallContr();"/>   -->
 <center><apex:commandButton value="Click here" onclick=" return callActionMethod();"/>
   <script>
    
      function callActionMethod()
      {
        alert('working..');
         var txtVal1 = document.getElementById("{!$Component.theForm.SRpageblock.pgbSec.txt1}").value;
         alert(txtVal1 );
         /*Below Method is generated by "apex:actionFunction" which will call Apex Method "echoVal" */
         echo(txtVal1); 
         return false; 
      }
</script>

------------- VF Page (Where data is displaying) -------------------
 <apex:form id="frmSRdescription">
    <apex:actionPoller reRender="frmSRdescription" interval="30" rendered="true" action="{!echoVal}"/>
        <apex:pageBlock >
                <apex:outputLabel value="{!test}"></apex:outputLabel>
                <b><apex:outputLabel value="{!val}" /></b>  <b><apex:outputLabel value="{!enteredText1}" /></b>