0
Q:

how to pass values from vf page to controller

public class aaPage52 {    public Integer X { get; set; }    public Integer X2 { get; set; }        public aaPage52() {        X = 0;        X2 = 0;    }    public PageReference TestX() {        String strX = ApexPages.currentPage().getParameters().get('X');        if (strX != null) {            this.X = Integer.ValueOf(strX);        }        return null;    }    public PageReference TestX2() {        return null;    }}
0
<apex:page controller="aaPage52">    <apex:form id="RID">        <apex:commandButton value="click" action="{!TestX}" rerender="RID">            <apex:param name="X" value="{!X + 1}" />        </apex:commandButton>        <apex:outputText value="{!X}"/><br/>         <apex:commandButton value="click" action="{!TestX2}" rerender="RID">            <apex:param assignTo="{!X2}" value="{!X2 + 1}" />        </apex:commandButton>        <apex:outputText value="{!X2}"/><br/>     </apex:form></apex:page>
0

New to Communities?

Join the community