There are two things wrong with your script, firstly JavaScript and the Alfresco JavaScript API are case sensitive - so the property name is wrong, you need:
var name = person.properties.firstName;
also the document.write(…) will not work - the document.write() function is part of the web browser JavaScript extensions - the Alfresco javascript engine is pure JavaScript 1.6 with our Alfresco extensions.
…I've just read the title of your post You can't execute Alfresco JavaScript within a JSP and expect it to work…! As i said earlier - the browser JavaScript API is very different to ours.
It cannot be used directly on a JSP page as it is executed withi the context of the server. However it can be used as part of the new Webscripts framework to build interactive pages with only some HTML/templating knowledge plus javascript: http://wiki.alfresco.com/wiki/Web_Scripts