• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

how to populate image through HtmlGraficImage object in the backing bean?

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I would like to populate the datatable , 4 column vlues. one column has image file. onclick of the image , i need to invoke some backing bean which poulates the table. while populating i need to set an image to datatable in the second column. how this can be done.? can you please help me out
?
Thanks
Prasad
 
Ranch Hand
Posts: 54
Tomcat Server Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm not sure what you mean by "populate image through HtmlGraficImage". From what it seems like you're describing, PrimeFaces' 'FileUpload' might work for you.
 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refer this coding koders.com/java/fid9B9AFD404F84FAC896DDA0D666A5DBB050E9724D.aspx. In this code binding method witch constructs an UIComponent Tree for JSF page and also Used for dynamic dataTable facility. That will helps you.
 
prasad kakani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thanks for your reply ..

@Louis,
what i meant is , i need to set an image to HtmlGraphicGmage instance. like the way we set input txt value to in bcaking bean,

//Datatable
populatedatatable(){
HtmlDataTable dataTable = new HtmlDataTable();
dataTable.setBorder(1);
dataTable.setValueExpression("value",createValueExpression("#{populateBean.dataList}", List.class));
dataTable.setVar("dataItem");
// Create <h:column> for 'ID' column.
HtmlColumn idColumn = new HtmlColumn();
dataTable.getChildren().add(idColumn);

// Create header <f:facet name="header"> of 'ID' column.
HtmlOutputText idHeader = new HtmlOutputText();
idHeader.setValue("ID");
// add header to column
idColumn.setHeader(idHeader);
// Create <h:outputText value="#{dataItem.id}"> for the body of 'ID' column.
HtmlOutputText idOutput = new HtmlOutputText();
idOutput.setValueExpression("value", createValueExpression("#{dataItem.id}", String.class));
//add output text to column.
idColumn.getChildren().add(idOutput);
}

private ValueExpression createValueExpression(String valueExpression, Class<?> valueType) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), valueExpression, valueType);
}
 
prasad kakani
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the answer..

This is the way we can set an image to htmlgraficimage instance.

HtmlGraphicImage graphicimage = new HtmlGraphicImage();
graphicimage.setUrl("./images/minusfinal.jpg");
graphicimage.setValueExpression("value", createValueExpression(graphicimage.getUrl(), String.class));
nameColumn.getChildren().add(graphicimage);
 
Saloon Keeper
Posts: 28424
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If I'm reading this correctly, you're attempting to use arcane JSF code to dynamically create a JSF component tree modification to display an image using an output text tag.

I doubt you need all this JSF-specific code. Most of us can get by with straight View Definition Language XML using an image tag.
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic