0

I want to call java method with parameter form .vm file can you please give me a simple example for it.

mail.vm

<HTML>
<head>
  <script >
    function functionUpdate(val){
    alert(val);
    alert(getElementById(val).value);  
    //now here i wanna call java method from my java class with 'val' as parameter                          
    }
  </script>
</head>

<BODY>
<br>
<span style='font-family:Arial; font-size:13px;'>
  <p>Dear User,
  <p>Please Rate the Module with your experience
  <form  name="ratings" >
  <input id="$rate" name="$rate" value="1" type="submit" onclick="functionUpdate('$rate');">
</span>
</BODY>
</HTML>

thank you

2
  • //now here i wanna call java method to my java class with 'val' as parameter Commented Jun 12, 2014 at 5:12
  • Make ajax call using JQuery or using other javascript Commented Jun 12, 2014 at 5:13

1 Answer 1

1

Javascript run at client side and java code runs at server side.

so you cannot directly call java method in javascript function.

although you can use ajax call using get or post method to call some servlet, and do call your methods.

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

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.