trying to put a file path in javascript. it is a pain
\ is an escape character and it always kill the character after the backslash
what i am doing is this
i am trying to add the file path from a jsp view object attribute
window.open("file"+<c:out value="${filePath}" />+fileName);
but if there are backslash in the end of filePath, it kills the following quotation mark
what is the most efficient workaround. do i have to change the java attribute notation (which i dont want to) or get a script to do it ?
Use
/instead of\. The/works fine in Windows as well. You can usefn:replace()to replace it.Note that I also fixed the “string concatenation”. Concatenating
c:outin Javascript style makes no sense.