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!
The JSTL does not need to be in the JavaScript block. It's not JavaScript and it's very very wrong to think that the JSP mehacnisms have anything whatsoever to do with JavaScript.
Did you read those articles? Especially the first one?
Continuing to think that the JavaScript code and the JSTL code have anything at all to do with each other is going to cause big-time problems for you unless you get the concepts straight in your mind right now.
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.
Not useful. The JSTL and any other JSP mechanisms execute on the server long before the page is sent to the browser. Once at the browser, the JavaScript is interpreted. They know nothing at all about each other!
Do a View Source at the browser and look at what your JavaScript block turned into. Is it useful?