Calling java function with parameter within javascript function

Hi All,

Is it possible to call java method within a javascript function? Let me explain a situation here -

I have a pop up where user types in certain values. When user clicks on Apply button, value is transferred to parent window and pop up is closed. Before closing the pop up, I need to validate the value. I already have a java method which validates the input. I want to use the same method in javascript which takes a parameter.

here is my javascript function -

function validate() {
    var value = document.getElementById('value').value;
    var isValid = <%= ValidationUtil.validatePath(value) %> // - where value is js variable
   return isValid;

I have already imported ValidationUtil in my jsp. This is not working. I can not use applet. Is there any way to handle this issue?

Thanks for any help.


Thanks for your reply. The link is really useful. But, it doesn’t work for me. Mine is a custom class which is not recognized by js at all.