graphicimage

BLOB images are displayed only on refreshing a page after an update via p:dataTable is made in PrimeFaces

笑着哭i 提交于 2019-12-01 02:27:25
问题 I'm displaying images stored in the form of BLOB in MySQL on a <p:graphicImage> as follows. <p:dataTable var="row" value="#{testManagedBean}" lazy="true" editable="true" rows="10"> <p:column headerText="id"> <h:outputText value="#{row.brandId}"/> </p:column> <p:column headerText="Image"> <p:cellEditor> <f:facet name="output"> <p:graphicImage value="#{brandBean.image}" height="100" width="100"> <f:param name="id" value="#{row.brandId}"/> </p:graphicImage> </f:facet> <f:facet name="input"> <p

Display p:fileupload image in p:graphicImage preview without saving it

Deadly 提交于 2019-11-30 19:59:12
I am using PrimeFaces 5.3 <p:fileUpload> to upload a PNG image and I would like to show a preview of it in <p:graphicImage> before saving in database. Here's a MCVE: <h:form enctype="multipart/form-data"> <p:fileUpload value="#{bean.uploadedFile}" mode="simple" /> <p:graphicImage value="#{bean.image}" /> <p:commandButton action="#{bean.preview}" ajax="false" value="Preview" /> </h:form> private UploadedFile uploadedFile; public UploadedFile getUploadedFile() { return uploadedFile; } public void setUploadedFile(UploadedFile uploadedFile) { this.uploadedFile = uploadedFile; } public void preview

Display uploaded image in JSF

孤人 提交于 2019-11-30 07:11:28
I have a view scoped bean where I create a person. A person can have a picture. This picture is uploaded the same page the person is created. The picture is not stored in a database or on disk (since the person isn't created yet). The bean has to be view scoped since a person can be created elsewhere and this uses the same bean. If the bean is session scoped and a user uploads a picture but does not save the person, the picture will be displayed next time the user tries to create a person. I solved this by using two beans; one view scoped bean to create the person and a session scoped bean to

Display p:fileupload image in p:graphicImage preview without saving it

江枫思渺然 提交于 2019-11-30 04:08:59
问题 I am using PrimeFaces 5.3 <p:fileUpload> to upload a PNG image and I would like to show a preview of it in <p:graphicImage> before saving in database. Here's a MCVE: <h:form enctype="multipart/form-data"> <p:fileUpload value="#{bean.uploadedFile}" mode="simple" /> <p:graphicImage value="#{bean.image}" /> <p:commandButton action="#{bean.preview}" ajax="false" value="Preview" /> </h:form> private UploadedFile uploadedFile; public UploadedFile getUploadedFile() { return uploadedFile; } public

How to make p:graphicImage clickable and invoke bean action

走远了吗. 提交于 2019-11-29 14:49:28
I am using <p:graphicImage> like below: <div id="mapp"> <h3>Country Map</h3> <p:graphicImage id="city" value="#{countryPages_Setup.countryMap}" width="250" height="190"> </p:graphicImage> </div> But this is not a clickable image. How can I make this image clickable so when user click on it, I can invoke the managed bean action that I want. Wrap your image in a h:commandLink / h:link : <h:commandLink action="..."> <p:graphicImage id="city" value="#{countryPages_Setup.countryMap}" width="250" height="190"> </p:graphicImage> </h:commandLink> If the p:graphicImage is inside a p:contentFlow, you

Show an InputStream as dynamic image in JSF

不羁的心 提交于 2019-11-29 12:19:50
How can we embed and show an InputStream as dynamic image in JSF 2.0 with OmniFaces? BalusC OmniFaces does not offer any utility for this — yet. If the image files are located on the disk file system, then you need to create a virtual context in the servletcontainer configuration so that they can be accessed by a normal URL. See also Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag . If the image files are stored in the DB, then you need to create a simple servlet which just writes the InputStream of the image from the DB to the OutputStream

Display uploaded image in JSF

百般思念 提交于 2019-11-29 09:06:33
问题 I have a view scoped bean where I create a person. A person can have a picture. This picture is uploaded the same page the person is created. The picture is not stored in a database or on disk (since the person isn't created yet). The bean has to be view scoped since a person can be created elsewhere and this uses the same bean. If the bean is session scoped and a user uploads a picture but does not save the person, the picture will be displayed next time the user tries to create a person. I

Show an InputStream as dynamic image in JSF

試著忘記壹切 提交于 2019-11-28 05:54:05
问题 How can we embed and show an InputStream as dynamic image in JSF 2.0 with OmniFaces? 回答1: OmniFaces does not offer any utility for this — yet. If the image files are located on the disk file system, then you need to create a virtual context in the servletcontainer configuration so that they can be accessed by a normal URL. See also Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag. If the image files are stored in the DB, then you need to

How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 16:28:34
I was trying to display a panel where user can see a list of items category(displayed as images) and on clicking they can view products within the category(images will be displayed) For displaying the item category, i used the ui:repeat nad the supporting bean calss Below is my xhtml code <ui:repeat id="repeat" value="#{getData.images}" var="img" varStatus="loop"> <h:panelGroup> <p:graphicImage id="img1" value="#{img}" alt="image not available" > </p:graphicImage> </h:panelGroup> </ui:repeat> And the Managed Bean Code parts private ByteArrayOutputStream baos = new ByteArrayOutputStream();

How to use <p:graphicImage> with DefaultStreamedContent in an ui:repeat?

久未见 提交于 2019-11-26 04:47:05
问题 I was trying to display a panel where user can see a list of items category(displayed as images) and on clicking they can view products within the category(images will be displayed) For displaying the item category, i used the ui:repeat nad the supporting bean calss Below is my xhtml code <ui:repeat id=\"repeat\" value=\"#{getData.images}\" var=\"img\" varStatus=\"loop\"> <h:panelGroup> <p:graphicImage id=\"img1\" value=\"#{img}\" alt=\"image not available\" > </p:graphicImage> </h:panelGroup