a:mediaOutput is not compatible with a Seam long running conversation
Over the weekend I was working on a Seam project that required images to be uploaded so I took a look at the rich:fileUpload component. Looking at the RichFaces sample code it looked very straightforward and I assumed it would take just a couple of hours to implement. 2 days later I still couldn’t get it to work. I was so frustrated that I started questioning my intelligence. Fortunately I am stubborn, just ask my wife, and I refused to give up. This time it paid off. I finally found out via the Seam framework forums that the a:mediaOutput RichFaces component is not compatible with Seam long running conversations. The file was uploading fine and the listener method could see the object but when it came time for a:mediaOutput to paint the object to the screen it could not be found.
The solution was to simply add an s:conversationID component to a:mediaOutput so that Seam would know the conversation id. Once I added this everything worked fine. UGH! Below is an example.
1 2 3 4 5 6 | <a4j:mediaOutput element="img" mimeType="#{file.mime}" createContent="#{fileUploadBean.paint}" value="#{row}" style="width:100px; height:100px;" cacheable="false"> <f:param value="#{fileUploadBean.timeStamp}" name="time"/> <s:conversationId value="#{conversation.id}"/> </a4j:mediaOutput> |
These are the kind of things that drive me crazy when programming. Things like this can totally blow a schedule out of the water.










Charles July 13th
Thank you! You save my day! lol
Brian July 13th
Glad it helped Charles.
Betto Mcrose July 16th
and you save my week =D
Brian July 17th
Betto – Glad it saved your week because it cost me a week.
Betto McRose July 17th
I also found another tip
for the FileUploaderBean I had to set the scope to conversation because there were no other way to find the back bean
I know it sounds stupid, but in the examples I found there are no comments about, just looking at the exadel’s demo page (which is the fist plate to look at) you will see
any way… God/Alá/Buda/or whatever save Internet!
=D
Rodrigo Okada July 29th
Thank you!
Brian July 29th
You are welcome Rodrigo. Glad it helped you.
arical December 16th
Hi Brian,
glad to found your solution. I thought I go crazy today….
Thank you!
PS: curios that I couldn’t find this solution on the seam site/forum.
Brian December 19th
Glad it helped arcial. I don’t think I ever found any answers on this at the seam forums either.
venu February 16th
hi .i have the same situation in my .xhtml in my code
.
every time i am uploading image Size is not increasing .it is showing 0 every time.
i am not able to see image in UI of a web page.can any one please help me to get out of this situation.
venu February 16th
Thanks a lot brian.Its working now for me
Brian February 16th
Glad it is working for you venu.
venu February 16th
hi brian
i able to see image in UI after keeping conversation id.but it is not saving in Database.i hope you can help me
venu February 16th
hi Brian i am eagerly waiting for your reply
Brian February 16th
venu – I will need to take a look at your code to see how you are trying to save the image. Email me the view, component, and entity and I will take a look at it.
venu February 16th
i have sent mail to your Email.pease help me to get out of this.i am working on it more than a week
venu February 17th
Brian Is that the only one mistake i have done.remaining every thing correct.i able to see the data,length in console ,when i am saving it saves as null in database.
Add Yours
YOU