开发者

jsFunction pass data to backingbean

开发者 https://www.devze.com 2022-12-27 15:07 出处:网络
I have a javascript that is calling a function addData(param1,param2,param3,param4) which is calling addClip at the end

I have a javascript that is calling a function addData(param1,param2,param3,param4) which is calling addClip at the end

And I need 开发者_如何学运维to pass those to a backing bean.

<a4j:form>
    <a4j:jsFunction name="addClip" action="#{backingBean.goGo}">
        <a4j:actionparam name="param1" assignTo="#{backingBean.param1}"/>
    </a4j:jsFunction>
</a4j:form>

But I can't seem to pass any values to the backingbean. I've even tried setting a static value for the actionparam. But when I try to do a Systemout on the setParam1 method it only prints out null. Have I missed anything important?


Your function defines one parameter, but is called with 4. I assume there is a javascript error (check your JS console (firefox)).

Get rid of the 3 unused parameters, and call it addClicp(param1)


You must do as the following code, if you want to pass 4 parameters to backing bean.

<a4j:form>
<a4j:jsFunction name="addClip" action="#{backingBean.goGo}">
    <a4j:actionparam name="param1" assignTo="#{backingBean.param1}"/>
    <a4j:actionparam name="param2" assignTo="#{backingBean.param2}"/>
    <a4j:actionparam name="param3" assignTo="#{backingBean.param3}"/>
    <a4j:actionparam name="param4" assignTo="#{backingBean.param4}"/>
</a4j:jsFunction>

0

精彩评论

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

关注公众号