Calling Java inside JavaScript Function

后端 未结 8 959
时光取名叫无心
时光取名叫无心 2020-12-04 02:26

Please tell me if we can call java inside javascript function ?


    

        
相关标签:
8条回答
  • 2020-12-04 02:50

    Yes, you can call Java from Javascript, both if you mean the Java-VM on the server and on the client; i assume you mean the client (the VM in the browser); take a look here:

    http://www.apl.jhu.edu/~hall/java/Java-from-JavaScript.html

    0 讨论(0)
  • 2020-12-04 02:53

    You can. In JSF you can use PrimeFaces' component p:remoteCommand, which would contain action method. Call that remoteCommand by its name from JS and the java method will get executed.

    JSF Page

        <p:remoteCommand name='rmt' action="#{bean.doWork()}"/> 
    

    In JavaScript

        function callJava {rmt();}
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题