Skip to main content

Calling setter on backing bean via JavaScript / AJAX using JSF2

1 reply [Last post]
lostinspace2011
Offline
Joined: 2007-08-01
Points: 0

My application requires me to invoke a setter on a backing bean instance. I am trying to do this using the following javascript code:

<br />
var stateListWidth = document.getElementById(myform:stateListWidth);<br />
stateListWidth.setAttribute("value", 100);<br />
jsf.ajax.request(this, event, {execute: 'myform:stateListWidth', render: 'myform:stateListWidth' });<br />

and added a hidden field as follows:

</p>
<p>

This is generally working, but I would was wondering if there is a better way to do this without using a hidden field.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vladperl
Offline
Joined: 2004-08-11
Points: 0

> This is generally working, but I would was wondering
> if there is a better way to do this without using a
> hidden field.

I believe there is no better way, at least for now :)

Please take a look on the following enhancement and if you like it then use your vote points :)

https://javaserverfaces-spec-public.dev.java.net/issues/show_bug.cgi?id=879