3 Replies Latest reply on Aug 17, 2007 9:50 AM by damianharvey

    Request parameters with s:link

    uke

      Hi!

      Is there any way _not_ to send along existing request parameters using s:link?

      I've got a situation where viewObject.xhtml?id=1 shows the object with id 1. And if I only request viewObject.xhtml, i get a new, empty object instead.

      The problem is that when viewing an object, and then clicking the "create object"-s:link (aimed at viewObject.xhtml), the id-parameter stays put, and thus ruins the point of the link.

      Any way around this, or is my design just flawed from the start?

      Thanks
      uke

        • 1. Re: Request parameters with s:link
          uke

          Btw. I tried propagation="none", but that only stripped the conversation-related parameters from the url, leaving it with a clean viewObject.seam?id=1 as a result.

          • 2. Re: Request parameters with s:link
            sjmenden

            The typical scenario for CRUD operations is to create an object by going to the viewObject.xhtml page without accessing another object first, or from a link which simply redirects you to viewObject.xhtml. You should not be trying to create an object if you are already on the page that views another object, that doesn't make sense. what is sticking that id there is probably your viewObject.page.xml or you may have that configured in pages.xml, depends on your setup.

            Instead of pasting all of the code here my best advice would be to seam gen a project, do ./seam new-entity and seam will generate everything you need for basic CRUD for you.

            -Samuel

            • 3. Re: Request parameters with s:link
              damianharvey

              If you want to axe the parameter try using an action on your link that sets it to null eg:

              <s:link view="/somepage.xhtml" action="#{myBean.resetStuff()}" propagation="none" value="my link"/>


              Cheers,

              Damian.