problem with <p:graphicImage update does not work

UI Components for JSF
Post Reply
rvecchio1
Posts: 7
Joined: 12 Sep 2011, 16:07

25 Oct 2013, 19:21

Updating the version of primefaces 3.5 to 4.0, the following code does not work anymore. Does not update the image, but if I perform a reload (F5 or CTRL + R) the new image is visible.

Does anyone have a solution? Help!

CODE XHTML:

Code: Select all

<div class="uploadImageBox">
									<p:fileUpload id="IdUpFileOBJ" widgetVar="IdUpWV"
										fileUploadListener="#{fileUploadMiniaturaMB.upload}"
										auto="true" multiple="false" label="#{msg.value_sfoglia}"
										mode="advanced" dragDropSupport="false" 
										update="IdUpPreview,IdUpCancella,IdUpFileName,:messages"
										sizeLimit="#{sessionMB.maxFileSize}" 
										allowTypes="/(\.|\/)(#{sessionMB.estensioneConsentite})$/" />

									<div class="singolaFoto">
									
										<p:graphicImage value="#{sessionMB.fileMiniatura}"
											id="IdUpPreview" width="200" height="200" cache="false" />
										<p:outputLabel value="#{fileUploadMiniaturaMB.fileNameUpload}"
											id="IdUpFileName" />


										<p:commandButton id="IdUpCancella"
											disabled="#{!(sessionMB.sizeFileMiniatura>0)}"
											value="#{msg.value_cancella}" immediate="true"
											actionListener="#{fileUploadMiniaturaMB.delete}"
											title="#{msg.title_cancella}"
											update="IdUpPreview,IdUpCancella,IdUpFileName">
											<f:attribute name="removeImageMiniatura" value="true" />
										</p:commandButton>
									</div>
								</div>
CODE JAVA:

Code: Select all

@ManagedBean(name = BeanNameConstants.FILE_UPLOAD_MINIATURA_MB)
public class FileUploadMiniaturaMB {


	public void upload(FileUploadEvent event) throws Exception {
		this.fileNameUpload = event.getFile().getFileName();
		SessionMB ses = FacesContext
				.getCurrentInstance()
				.getApplication()
				.evaluateExpressionGet(FacesContext.getCurrentInstance(),
						"#{" + BeanNameConstants.SESSION_MB + "}",
						SessionMB.class);
		ses.setUploadedFileMiniatura(event.getFile());
	}
.....
.....
}
CODE JAVA:

Code: Select all

@ManagedBean(name = BeanNameConstants.SESSION_MB)
@SessionScoped
public class SessionMB extends BaseMB {

	private String estensioneConsentite;
	private String maxFileSize;
	public long sizeFileMiniatura;

       ...........

	public StreamedContent getFileMiniatura() throws Exception {
		if (this.removeImageMiniatura != null && !this.removeImageMiniatura
				&& uploadedFileMiniatura != null) {
			InputStream is = uploadedFileMiniatura.getInputstream();
			setSizeFileMiniatura(uploadedFileMiniatura.getSize());

			String estensione = Utility.findMimeTypeImage(uploadedFileMiniatura
					.getFileName()); // return "image/jpg"

			return new DefaultStreamedContent(is, estensione);
		} else {
			this.removeImageMiniatura = false;
			uploadedFileMiniatura = null;
			setSizeFileMiniatura(0);
			return null;
		}
	}

        ........
}
Application Server: Jboss 6 EAP
Jdk: 1.7
JSF: 2.1
Primefaces: 4.0

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

25 Oct 2013, 20:09

use forum search... already fixed in elite releases.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

27 Oct 2013, 13:18

This is one of the reasons, I honestly think te fist 2 or 3 'elite' releases should be publically available. It's kind of not 'appropriate/fair/nice' that fixes for regressions like this are only available for elite members.

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

27 Oct 2013, 14:00

kukeltje wrote:This is one of the reasons, I honestly think te fist 2 or 3 'elite' releases should be publically available. It's kind of not 'appropriate/fair/nice' that fixes for regressions like this are only available for elite members.
+1 from my side - but it's not my decision
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 46 guests