In web development we are commonly used to keep Javascript code in separate files, but sometimes we need this Javascript code to manipulate server side data locally.
For example, making an Ajax Call to a dynamically created URL server side.
But some programmers My colleagues
keep saying that plain Javascript in the JSP file is a sign of bad code, and wrong practices.
To what extent are they right ? Assuming that those blocks of code are not reusable in other pages, why is this practice perceived as a bad thing?
Edit :
Thanks for the quick answers, I'm still wondering how can I manage Dynamically created Javascript code (which cannot be cached, obviously). For example making an ajax call with an URL like this :
url : ${some_url_coming_from_server},
In my case the code is huge, and I have server-data everywhere, am I doing it wrong ?