+ 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?
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


Let me know if it helps !!
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.
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}"/>
        <apex:commandButton value="JSON GENERATOR"  action="{!genereatejson}"  />

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

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);
 public void genereatejson(){
          JSONGenerator gen = JSON.createGenerator(true);
          jsonstrng = gen.getasString();
       public  class statedetails{
       public string stateName{get;set;}
       public string value{get;set;}
       public integer rating{get;set;}