Rohan Patil
Rohan Patil

Reputation: 277

Display Images From a file System using Richfaces + Spring Webflow

I am not able to display images from the file system in the xhtmls using <h:graphicImage> tag. I am using Spring webflow 2.0 and Richfaces 3.3.3

Should I write a separate servlet to serve the images from the file system ?

I looked into <a4j:mediaOutput> tag . Can I use this ? since createContent requires us to specify a method that will be used for content creating. I am unsure if we can use the flow variables/beans to execute methods in the tag.

Upvotes: 0

Views: 1726

Answers (1)

niksvp
niksvp

Reputation: 5563

You can always fetch the images placing under Web Pages folder

<h:graphicImage url="#{facesContext.externalContext.requestContextPath}\your_img_path_under_Web_pages" id="img" />

If you use <a4j:mediaOutput> tag, then yes you should give method in createContent which will draw the image.

  <a4j:mediaOutput element="img" createContent="#{serviceBean.method}" value="#{dataBean}" mimeType="image/jpg" />

public void userImage(OutputStream out, Object data) throws IOException {/*your method body*/}

Upvotes: 1

Related Questions