0

I have a JSP page which doesn't actually have any server tags in it so its basically an HTML page. But, my work is in love with JSP so I set it as a .jsp file. Anyhow, Tomcat is under the belief that my JavaScript is in fact Java code and tries to parse it. I get a nice big error on the screen saying its not a real function, etc. Could anyone tell me why its doing this? Code below...

...
<script>

    $(function() {

        $.dragAndDrop({
            dom: {
                fileList: '#fileList tbody',
                contextMenu: '#fileContextMenu',
                dropzone: '#dropzone'
            },
            templates: {
                file: '<tr><td>${fileName}</td><td>${$.dragAndDrop.getDate()}</td><td>${$.dragAndDrop.parseSize(size)}</td></tr>'
            }
        });

    });

</script>
...

The error:

org.apache.jasper.JasperException: /index.jsp(22,42) The function getDate must be used with a prefix when a default namespace is not specified
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
4
  • Well you have ${$.dragAndDrop.getDate()} and ${...} marks expressions for evaluating by JSP. Commented Feb 11, 2011 at 16:16
  • That's the problem. Thanks :p I had the understanding that JSP tags were <% %> but since I never use them I didn't really know. Commented Feb 11, 2011 at 16:24
  • It was introduced in JSP 2.0 I think. Commented Feb 11, 2011 at 16:26
  • You are right about JSP 2.0. I think that it was introduced along with Java EE 5. @Felix Commented Feb 11, 2011 at 17:44

2 Answers 2

3

${} marks expressions for evaluating via JSP. As you say you don't use any JSP, you can disable the expressions language by adding

<%@ page isELIgnored="true" %>

to your page.

Sign up to request clarification or add additional context in comments.

Comments

2

It is likely the ${ notation

Try replacing this code ${$

with something like this $' + '{$

or $<%='{'%>$

I don't know if there is a proper way to escape that,, but what I just gave you should work.

See Google for more information. The top result looks good but I could not find how to do a proper escape: http://www.google.com/search?q=jsp+dollar+sign

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.