This week's book giveaway is in the Testing forum. We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line! See this thread for details.
Code #1 uses requestScope["name"] to access the request attribute name. This will work as expected. However requestScope[name] , Here name is without quotes so the
1) container will now search for a attribute "name" in all the 4 scopes one after other and it will find name in request scope with a value "To test thekey and attribute differences"
2) Container will now convert this to requestScope["To test thekey and attribute differences"] and it will search again a attribute with name = "To test thekey and attribute differences" in all the 4 scopes and it will find none and since EL handles null gracefully it will return empty string.
To confirm the above explanation try this EL empty operator.
Result: requestScope["name"]--------->To test thekey and attribute differences requestScope[name]--------->true