Skip to main content

Accessing component variables from backing beans

3 replies [Last post]
jvence
Offline
Joined: 2006-06-21

Not sure if this question is specific to jmaki but I would like to know if variables defined within the jmaki components can be accessed from a backing bean. Or perhaps to pass these variables to the bean. For example I would like to access ibrowser's 'i' variable so when a user is viewing an image, he can click on an image to edit the title or description.
Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31

The Image Browser is currently not wired to take input from a backing bean as there is no real value associated with it as it's a more visual component.

Widgets that have values that are mapped to backing beans include the editor components, calendar, and time picker.

The ibrowser needs an overhaul and if there are values you think would be good to expose please let us know.

jvence
Offline
Joined: 2006-06-21

Is there a way to pass variables from the iBrowser to a backing bean?

gmurray71
Offline
Joined: 2003-07-31

This could be done but you will need to customize the ibrowse component.js to communicate with the backing bean.

To set up the communication you will need to add a value attribute with the value binding expression to the backing bean you would like to communicate with.

For example:

In this case your component.js will be provided with a property widget.valueCallback which is a URL that will activate the PhaseListener in jMaki to update a value on the respective managed bean. See the code from I used with the Dojo Datepicker component.js for an example:

// add a saveState function
if (typeof widget.valueCallback != 'undefined') {
jmaki.doAjax({method: "POST",
url: service,
content: {value: "some new value",
cmd:"update"},
callback: function(_req) { processMessagePost(_req);}}
);
}

This uses jmaki.doAjax to POST back function to do the same type of thing. You will need to include the new value as "value" and a property "cmd" which is equal to update.

See the Dojo Calendar and the Dojo ComboBox JSF examples for more.