开发者

How to access javascript value in a4j

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜