How do you run this code? I mean whats the url that you specify in the browser. I believe the reason why you are seeing the directory listing has got nothing to do with the code that you have written in the jsp. Looks like its got to do with the URL that you are specifyig to access the jsp.
No, there is no problem to view the JSP page if I remove (or replace) the InitialContext.
By "Directory listing", do you mean the contents of the war file are shown? Are you seeing any exceptions in the server.log file(or even the console) when you run that JSP? If yes, please post the exception stacktrace(Please remember to use the Code button, to wrap the exception stacktrace in a code block, while posting).