Just found that there is one property of Jmeter that I can set so as to get the value of a cookie.
The following is from Jmeter site (http://jmeter.apache.org/usermanual):
"Received Cookies can be stored as JMeter thread variables(versions of JMeter after 2.3.2 no longer do this by default).To save cookies as variables, define the property "CookieManager.save.cookies=true".Also, cookies names are prefixed with "COOKIE_" before they are stored (this avoids accidental corruption of local variables)To revert to the original behaviour, define the property "CookieManager.name.prefix= " (one or more spaces).If enabled, the value of a cookie with the name TEST can be referred to as ${COOKIE_TEST}."
The problem that I got is where to set this property: CookieManager.save.cookies=true.
In a rush, I googled and found that there is a property file under the Jmeter install directory: jmeter.properties, where I can set that boolean value as above. In order to save time, I just update this file. Actually I can override these properties via the command Line:
The following is also from Jmeter site (http://jmeter.apache.org/usermanual):
Java system properties, JMeter properties, and logging properties can be overriden directly on the command line (instead of modifying jmeter.properties).To do so, use the following options:
-D[prop_name]=[value] - defines a java system property value.
-J[prop name]=[value] - defines a local JMeter property.
-G[prop name]=[value] - defines a JMeter property to be sent to all remote servers.
-G[propertyfile] - defines a file containing JMeter properties to be sent to all remote servers.
-L[category]=[priority] - overrides a logging setting, setting a particular category to the given priority level.
The -L flag can also be used without the category name to set the root logging level.
Examples:
jmeter -Duser.dir=/home/mstover/jmeter_stuff \ -Jremote_hosts=127.0.0.1 -Ljmeter.engine=DEBUG jmeter -LDEBUGN.B.
The command line properties are processed early in startup, but after the logging system has been set up.Attempts to use the -J flag to update log_level or log_file properties will have no effect.