1 Reply Latest reply on Apr 21, 2007 8:01 AM by Pete Muir

    Using @RequestParameter in EntityHome

    Robin Young Newbie

      Can you please post an example of using an @RequestParameter for the id of an entity in a class that extends EntityHome?

      I have it mostly working in that if I inject the id using @RequestParameter and override the getId() method it will create correctly and display correctly but it fails to update.

      If your answer is to ignore the question and tell me to use pages.xml then I've already done that and it works. However if that is the only solution can anyone tell me how to do a wildcard match in pages.xml. i.e.

      <page view-id="/facelets/*/adminEditMyEntityTarget.xhtml">



      as this also doesnt appear to work?

        • 1. Re: Using @RequestParameter in EntityHome
          Pete Muir Master

          The problem is that if you *don't* pass the id as a request parameter when you come to do the update, then the id will be null (@RequestParameter doesn't magically remember stuff ;).

          If you are passing the id in when the EntityHome is created

          @RequestParamter Object id;
          
          protected Object createInstance() {
           if (id != null) {
           assignId(id);
           }
           return super.createInstance();
          }