0

I have jQuery code in a JSP:

${'#userid').val('admin')

The app server is interpreting the jQuery code as JSP:

The function val must be used with a prefix when a default namespace is not specified

How do I "escape" the JavaScript?

1 Answer 1

5

There is absolutely no problem in using javascript in jsp pages.

Your example does not work because it is not valid jQuery - instead it starts like an EL expression. Your first bracket should not be curly:

$('#userid').val('admin')
Sign up to request clarification or add additional context in comments.

1 Comment

@teddy - if the answer works for you, feel free to mark it as accepted (tick below the vote counter)

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.