With EL's . operator you may access an attribute set in one of the four scopes or a bean's property. The String name variable, at translation time, just gets to be an instance variable in your servlet class. You may access it using a simple expression:
The error you get when using pageContext is because you don't have a JavaBean property named name defined into your servlet class. You need to define a getter for it.
You may set an attribute in one of the four scopes but just like below and then access it with the:
But this three are poor examples showing you how the things are working.