You need to sign in to do that
Don't have an account?
Data from Controller class to VF page
Hello,
I have a VF page that needs to submit some values (param1 and param2) via Http POST. To facilitate this, I have a controller class with a method that retrieves data for param1 and param2 and calls another VF page (FormPage) that contains a form with hidden fields (to perform the HTTP POST)
In the controller class:
controllerA class {
public String getparam1 () { return param1 ; }
public void setparam1 (String data) { param1 = data; }
public String getparam2 () { return param2 ; }
public void setparam2 (String data) { param2 = data; }
public PageReference prepareData(){
**exec queries to retrieve param values
param1 = obj1.firstName;
param2 = obj1.lastName;
PageReference p = Page.FormPage;
return pageRef;
}
}
In the VF FormPage:
<apex:page showHeader="false" controller="controllerA" >
<body onload="document.getElementById('wcform').submit();">
<form id="wcform" method="post" action="http://connect.com/abc.do">
<input type="Hidden" name="p1" value="{!param1}" />
<input type="Hidden" name="p2" value="{!param2}" />
</form>
</body>
</apex:page>
The values in param1 and param2 are not passed to the FormPage VF page. Can someone help me fix this? Thanks.
how is prepareData getting called?
prepareData( ) is called by another VF page:
<apex:commandLink value="View Details" action="{!prepareData}" target="_blank">
And Param1 and Param2 values are retrieved in the Controller class. I have confirmed this.