Can someone test this example and share the results?
http://timothypowell.net/blog/?p=23
When I do:
var myVar = \'<% request.getContextPath(); %>\'
You cannot run scriptlet inside javascript by giving it normal .js extension. However you can give your .js the file extension of .jsp and then and link directly to it as:
and now you can use jsp within your javascript like:
var someMessage = "${someMessage}"
var anotherMessage = "${anotherMessage}"/>"
This action is completely valid because what determines whether a file is a javascript file or not is what MIME media type. You can set MIME from JSP using:
<%@ page contentType="text/javascript" %>