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.



Comments

  1. Charles July 13th

    Comment Arrow

    Thank you! You save my day! lol


  2. Brian July 13th

    Comment Arrow

    Glad it helped Charles.


  3. Betto Mcrose July 16th

    Comment Arrow

    and you save my week =D


  4. Brian July 17th

    Comment Arrow

    Betto – Glad it saved your week because it cost me a week. ;-)


  5. Betto McRose July 17th

    Comment Arrow

    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


  6. Rodrigo Okada July 29th

    Comment Arrow

    Thank you!


  7. Brian July 29th

    Comment Arrow

    You are welcome Rodrigo. Glad it helped you.


Add Yours

  • Author Avatar

    YOU


Comment Arrow



About Author

Brian

Brian Abston is an IT Manager in Oklahoma that also still gets his hands dirty and writes Seam code. He also dabbles in Ruby and Rails. He loves to code and hates to manage. Jack of all trades and master of some.