File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to make an image rerender when its value(src) changes using AJAX. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "How to make an image rerender when its value(src) changes using AJAX." Watch "How to make an image rerender when its value(src) changes using AJAX." New topic
Author

How to make an image rerender when its value(src) changes using AJAX.

Zafar Hakim
Greenhorn

Joined: Nov 04, 2008
Posts: 6
Problem:
I Have a jsf component which is basically made of html Table. Each cell contains an image. On click of the image I want to change the image using AJAX. I am using Ajax4jsf from RichFaces and I am able to call a jsFunction which will be invoking a action(method) from the bean class. In the action method I decide depending on some condition which image to show. I am changing the image value in the object HTMLGraphicImage ( from which I am displaying the table, provided by RichFaces ) which is a member of the bean. Now I want to see this is reflected at the client. How do we rerender the image here when image source changes?

Code in action method looks something like this:
*********************************************************
...
...
hgImage= (a bean).getHgImage;

hgImage.setValue(imgSrc); // imgSrc changed
...
AjaxContext ajaxContext = AjaxContext.getCurrentInstance();
if(ajaxContext != null && ajaxContext.isAjaxRequest()) {

// WANT to Add the image with id "hgImage.getId()" to the list that are to be re-rendered.
}
*********************************************************

Any help is highly appreciated.

Regards,
Zafar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make an image rerender when its value(src) changes using AJAX.
 
Similar Threads
Seam ajax rerender rich:dataTable
problem in reading requestMapping in spring mvc 3.0
jsf 1.2 Facelets - Double clicks on a selectManyListbox
rich:dataTable and rich:listshuttle rerendering issue
Ajax4JSF - Can't generate ajax call from JSF page