5 Replies Latest reply on Jul 31, 2012 5:09 AM by periklis_douvitsas

    JsessionId getting appended to image rendered by h:graphicImage

    selfcare

      Hi,

       

      Am using JSF 1.2

       

      I have an image which should be clickable. Below is how I have coded,

       

      <h:commandLink value="" action="#{myBean.myAction}>

            <h:graphicImage value="image-location-in-webserver">

      </h:commandLink>

       

      Am using h:commandLink because on click of this image I have to do some business validations and hence I need to call a method in bean.

      My bean is session scoped. I can't go with request scope because of some other problems.

      I tried javax.faces.STATE_SAVING_METHOD setting it to client instead of server.

      Even then when my page is rendered, image is not getting redered because jsessionid is getting appended to url like below when viewed in web developer.

       

      http://myDomain/static-files/images/myImage.jpg;jsessionid=77F2A5D24CF1D5C3C4882778BC521263.node1

       

      If jsessionid is not appended, my image gets rendered.

       

      I tried URL rewrite in urlrewrite.xml as mentioned below. It didnt work

      http://javatechworld.blogspot.in/2011/01/how-to-remove-jsessionid-from-url-java.html

       


      I wrote a rewrite rule in Apache web server. Didnt work!

       

      I have to use h:graphicImage instead of <img src> because I need to call a method in bean. If I use <img> tag, jsessionid is not appended.

       

      Please help!

       

      Regards,

       

      Vikas