I know that S2 provides a clean way to fetch the request parameters in you action class all you need to follow these simple rules.
- Create a property with same name as request parameter name.
- Create getter and setters for this property or make property public (for S2.1+)
However, when I do this in an AJAX call like this:
$.ajax({
url: '/gma/getJSONData.action?tspName='+tspName+'&thresholdType='+thresholdType,
I don't get the tspName parameter inside action class. I created the getter/setter for it. It's displaying null value.
Am I wrong somewhere?
EDIT:
I was checking the value of tspName in my Action class constructor, so was printing null. However, in my execute method it displays the value correctly. Why is it so? It means before constructor call it does not initialize values?