This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
If the returned HTML is assembled manually (so to speak), then it should be possible for the server code to read the contents of the .js file -and include it in the response- without too much difficulty.
If would get trickier if there was some kind of framework that generates the response.
Joined: Jun 24, 2010
yes you are right, the problem though is I am including a (large) jquery function, which has dependencies on other jquery functions (in other .js files), so it would be awful nice if I could get the container to do it. one thought I had was if I could write a restful JSP (instead of a servlet) then the container would automatically include any referenced js files.
Joined: Mar 22, 2005
This may cause timing problems, though, since the loading (and eventual execution) of the script will take place when the currently executing code has finished running (or at best concurrent to it with no control over which gets run first). You may have to add some callback-like features to the newly-loaded code so that execution can resume once its loaded.