开发者

How to access javascript value in a4j

开发者 https://www.devze.com 2022-12-18 23:58 出处:网络
I need to set a Bean value with one javascript return value. Something like: <script type=\"text/javascript\">

I need to set a Bean value with one javascript return value.

Something like:

<script type="text/javascript">
  function getUserId(){
     return 4;
  开发者_如何学JAVA}
</script>

<h:inputText name="lala" value="getUserId()"/>

Thanks


I solved it.

I was using a:jsFunction tag as it follows:

  <script type="text/javascript">
        function getUserId(){
                var user = MyCompany.get_User();
            return user;
        }
    </script>

<a:jsFunction action="#{user.performLogin()}" name="doSiteLogin"  >
   <a:actionparam name="uid" value="getUserId()"/>
</a:jsFunction>

If you use the property noEscape="true" on the a:actionparam ... it call your javascript code.

0

精彩评论

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

关注公众号