Put parameter from JavaScript into EL function call in JSF2
In JSF2 we can use parameters in EL, which is great. However, I don't know how to use parameters from JavaScript there. This code doesn't work:
<script type="text/javascript"&开发者_如何学编程gt;
var dirty = true
</script>
<h:commandButton value="Back" action="#{bean.setDirty(dirty)}" />
Is it possible to add parameters from JavaScript? How to do it?
No. Bind a hidden field to the bean and use JavaScript to set the hidden field value. When the request is submitted, the hidden value will be available to your server-side action.
精彩评论