p:media not working in iteration components

UI Components for JSF
Post Reply
LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

09 May 2019, 13:55

Dear all,

I've got the following use case:
  • dataTable the holds data
  • line selection to open a popup per data
  • data contains documents which were loaded on request in another popup
I've got a component for the detail data. Due to a undefined number of detail views open, the component is nested inside a c:forEach tag.

Code: Select all

<c:forEach
			items="#{...}"
			var="popup">
			// popup content in a component which contains a p:dialog
			...
			// popup for the pdf content
			<p:dialog ...>
			<p:media
				player="pdf"
				width="525"
				height="700"
				cache="false"
				value="..DefaultStreamedContent object..." />
			</p:dialog>
</c:forEach>
I tried it with c:forEach and ui:repeat... When I use the p:media tag inside an iteration the content is not lodaed.

The code produces this error message:
Failed to load resource: the server responded with a status of 404 (Not Found)
Uncaught (in promise) undefined


When I run the same code in one single popup without the iteration it works as aspected without any error msg.

kind regards
Lars

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

09 May 2019, 15:45

Probably the same problem when using graphicImage with streamedContent in iteration. just google a bit.
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

LarsD
Posts: 69
Joined: 25 Nov 2011, 22:47
Location: Dresden, Germany

10 May 2019, 12:46

Hi tandraschko.

Thank for your replay..

I tried this one:
https://stackoverflow.com/questions/804 ... pdatatable

It is not working, because the loading of the resource is not the problem.

When the component is working correctly to get the stream from the bean it calls 4 times the getter for the stream:
  • Call 1: LifeCycle Phase Validation
  • Call 2: LifeCycle Phase Invoke Application
  • Call 3: LifeCycle Phase render Response
  • Call 4: no LifeCycle Phase, call from the Browser Plugin the handles <embed> Tag
In the first 3 cases I return an empty DefaultStreamedContent object because it makes no sense to deliver the stream during the life cycle. In case 4 I deliver the stream and it works.

The problem is: If the component is inside a ui:repeat or c:forEach tag the plugin fails between call 3 and call 4. So for some reason the created code itself fails, not the loading procedure in the bean. The loading procedure is not invoked at all.

kind regards
Lars

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 26 guests