1 Reply Latest reply on Aug 20, 2008 10:58 PM by Samuel Mendenhall

    Seam url parameter

    guy bashan Apprentice

      I have a url passing parameter problem.
      I have a table showing items. each item shows details. one of the details is a url which directs to user home. each user has each own home. I want the url to contain the userId, in order for page to be bookmarakble. so I put in my pages.xml:



        <page view-id="/user.home.public.xhtml" action="#{userHome.setHomeUser()}">
          <param name="userId" value="#{video.user.userId}"/>
        </page>




      After I press user home link I get to the page and all seems fine. But my h:messages tag shows this error when page is loaded:


      model validation failed:javax.el.PropertyNotFoundException: Target Unreachable, 'user' returned null on 'com.nikonians.ui.model.bo.Video'



      Another thing that I don't understand: I may want to get to this page from other pages in the application. Pages that may not have:


      #{video.user.userId}



      but for example only


      #{user.userId}




      How can it be done? I think I don't understand how to implement the param tag correctly...


      Thanks,
      Guy

        • 1. Re: Seam url parameter
          Samuel Mendenhall Apprentice

          What scope is the video object in?  What might be happening is the video object becomes detached, so then if user is lazy, it can't be loaded when you attempt to access the userId.  The solution for that would be to eager loda the user.


          If you wanted to use #{user.userId} you'd have to make sure the user was outjected to the right scope.


          If the above doesn't help, post code.