4 Replies Latest reply on May 24, 2009 8:55 PM by Dan Allen

    empty page parameter "from" doesn't work

    Pawel Kaczor Newbie

      This is a fragment from code generated by 'Seam Generate Entities' wizard  of JBossTools:


              <s:button view="/#{empty employeeFrom ? 'EmployeeList' : employeeFrom}.xhtml"
      
                          id="done"
      
                       value="Done"/>



      After clicking the button previous page should be displayed but it is not. Always EmployeeList.xhtml page is displayed because 'employeeFrom' parameter is empty.


      'employeeFrom' is correctly declared in Employee.page.xml page:



      <param name="employeeFrom"/>



      What's wrong? Is it a bug?

        • 1. Re: empty page parameter "from" doesn't work
          Dan Allen Master

          There is a very specific use case for this. The entityFrom parameters are used to track navigation between related entities. For instance, if you clicked on a company, then clicked on an employee in the employee list on the company page, then this would parameter would be used to get you back to the company. It is not universal.

          • 2. Re: empty page parameter "from" doesn't work
            Dan Allen Master

            [Edited version]


            There is a very specific use case for this. The entityFrom parameters are used to track navigation between related entities. For instance, if you clicked on a company, then clicked on an employee in the employee list on the company page, then this parameter would be used to get you back to the company. It is not universal.

            • 3. Re: empty page parameter "from" doesn't work
              Matt Davis Newbie

              So you're saying that the entity portion of entityFrom has to correspond to an entity name? I'm really confused about this feature.


              In Seam in Action, it calls them Valueless page parameters used to pass values around. I don't understand when the value is assigned to the valueless page parameter. When would it every not be empty?

              • 4. Re: empty page parameter "from" doesn't work
                Dan Allen Master

                I'm saying that it begins as a query string parameter. So somewhere in the application you must see a URL like the following:


                /EmployeeEdit.seam?employeeFrom=Company&...



                In the EmployeeEdit.page.xml file (for instance) this request parameter is mapped into the page-scope using an anonymous page parameter (not valueless):


                <param name="employeeFrom"/>



                What that does is allow you to reference the value as a top-level context variable, #{employeeFrom}, and ensure that it survives through a postback. So when you save the employee, it will notice that employeeFrom got saved and redirect you to the company page rather than back to the list of employees.


                So understand that this flow of redirecting the user based on this variable is something specific to seam-gen, while anonymous page parameters are the feature of Seam being utilized. In short, think of it as an alternative to hidden form fields.