开发者

How to call javabeans methods from within javascript functions?

How can I call javabeans methods inside javascript 开发者_开发技巧functions?

I need with no success the following code:

        <script type="text/javascript">
            function openFullContent(chosen){
                #{bean.choseValue(chosen)};
            }
        </script>


The javabeans are running on the server, and the javascript is running on the client. JSF is rendering the javascript completely, then sending it as plain text to the browser over the wire. The two processes aren't even running on the same machine.

To communicate with the server like this, you need to look into Ajax.

Here's a JSF-centric Ajax tutorial.


Primefaces remoteCommand is the thing you are looking for!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜