There is my code:
But when I run that page, I get an the alert message saying
ReferenceError: pageContext is not defined
Can anyone help me solve this issue?
The Java code that you posted (to set the scoped variable/attribute) should be in the servlet that gets invoked prior to forwarding to the JSP.
As a newcomer to JSP, I recommend reading
Zain Rizvi wrote:Well I also had another approach. This seems to be better working for me.
While it may appear to be working, it's still off the mark. Way off!
Did you read those articles? Especially the first one?
I added the try/catch block at first there was nothing being printed to screen. So I wanted to see if something was going wrong.