function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vivek kumar 19vivek kumar 19 

Display in another vf page from first vf page.

I have to take input in vf page using html tag <input type> then capitalize the input and display it in another vf page. How should I approach?
ManojjenaManojjena
HI Vivek,

I thgik you want to add one existing Vf page to teh second VF page .
You can use <apex :include > component to add in vf page.

for more detail you can check below link

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_include.htm 

Let me know if it helps !!
Thanks
Manoj 
vivek kumar 19vivek kumar 19
Hi Manoj,
I will have to use a common controller for both the pages. I would want to know if it's possible to provide value to the page field using controller.
Then only I can take input from one page, perform some operations on the provided input and then display it in another page.
ManojjenaManojjena
HI Vivek,

Yes you can .
Annu ChoudharyAnnu Choudhary
Hi Vivek,

Can you please try this one it is working for you. If you like this solution please select it as the best answer.

Page 1:
 
<apex:page controller="controllertest1">
    <apex:form >
   Enter Name:<apex:inputText value="{!statedet.stateName}"/>
        <br/>
        <apex:commandButton value="JSON GENERATOR"  action="{!genereatejson}"  />
  </apex:form>
</apex:page>

Page 2:
 
<apex:page controller="controllertest1">
 <apex:include pageName="testpage1"/>
  <br/>
  <apex:form >
     <apex:actionSupport event="onClick"
                        action="{!genereatejson}"
                        rerender="tm"/>
   <apex:outputLabel id="tm"> {!jsonstrng}</apex:outputLabel>
  </apex:form>
</apex:page>

Controller:
 
public class controllertest1{
   public statedetails statedet{get;set;}
   public string jsonstrng{get;set;}
   public  controllertest1(){
     string  teststring= ' { "sucess":1,"data": {"stateName": "Andrapradesh",  "value": "apx" ,"rating":5 } } ';
     Map<String, Object> maptest =   (Map<String, Object>) JSON.deserializeUntyped(teststring);
     Object ob = (Object)maptest.get('data');
     String srlze  = System.JSON.serialize(ob);
     statedet= (statedetails)System.JSON.deserialize(srlze,statedetails .class);
       System.debug(statedet);
    }
 public void genereatejson(){
          JSONGenerator gen = JSON.createGenerator(true);
          gen.writeStartObject();
          gen.writeStringField('stateName',statedet.stateName);
          gen.writeEndObject();
          jsonstrng = gen.getasString();
   }
      //wrapperclass
       public  class statedetails{
       public string stateName{get;set;}
       public string value{get;set;}
       public integer rating{get;set;}
       }
}

​​​​​​​​​​​​​​