2

param2 value null in doSomething method

public String param1 { get { return 'Welcome Message'; } }
    public String param2 { get; 
        set {
            param2 = value;
        } 
    }

    public PageReference doSomething() {
        return null;
    }

<apex:commandButton action="{!doSomething}" value="Click">
    <apex:param name="param2" value="{!param1}" assignTo="{!param2}"/>
</apex:commandButton>
2
  • It could be just a case of not seeing your actual code, but, as is, there doesn't appear to be a need for you to use <apex:param> here. If param2 is simply holding the value of param1, then you can simply use param1 in your logic instead of param2.
    – Derek F
    Commented Mar 18, 2017 at 13:10
  • @DerekF I have just posted sample one from that code Commented Mar 18, 2017 at 14:49

1 Answer 1

2

apex:param is working perfectly, problem is with command button rerender

<apex:commandButton action="{!doSomething}" value="Click" rerender="none">
        <apex:param name="param1" value="{!param1}" assignTo="{!param2}"/>
</apex:commandButton>
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .