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.


  8. arical December 16th

    Comment Arrow

    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.


  9. Brian December 19th

    Comment Arrow

    Glad it helped arcial. I don’t think I ever found any answers on this at the seam forums either.


  10. venu February 16th

    Comment Arrow

    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.


  11. venu February 16th

    Comment Arrow

    Thanks a lot brian.Its working now for me


  12. Brian February 16th

    Comment Arrow

    Glad it is working for you venu.


  13. venu February 16th

    Comment Arrow

    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


  14. venu February 16th

    Comment Arrow

    hi Brian i am eagerly waiting for your reply


  15. Brian February 16th

    Comment Arrow

    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.


  16. venu February 16th

    Comment Arrow

    i have sent mail to your Email.pease help me to get out of this.i am working on it more than a week


  17. venu February 17th

    Comment Arrow

    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.


  18. Two Hands July 13th

    Comment Arrow

    Great!


  19. Brian October 7th

    Comment Arrow

    Glad it helped you Two Hands.


  20. Ricky Rito October 16th

    Comment Arrow

    Thanks!


  21. murkein November 5th

    Comment Arrow

    Gracias, estuve investigando y por fin encontre esta solucion.


  22. Brian December 11th

    Comment Arrow

    You are welcome murkein.


  23. Brian December 11th

    Comment Arrow

    You are welcome Ricky.


Add Yours

  • Author Avatar

    YOU


Comment Arrow




About Author

Brian

Brian Abston is a Java Developer in Oklahoma who also loves technology.