1 Reply Latest reply on Apr 1, 2007 10:07 PM by x y

    EntityHome request parameter

    x y Newbie

      Hi- I am having trouble receiving a different request parameter other than what is generated by seam-gen..

      I have the following code in the XXXHome.. eventId comes in just fine but the parentId is null..

      @RequestParameter
      Long eventId = null;

      @RequestParameter
      Long parentId;

      Here is the XXXlist. xhtml fragment that calls that code..

      <h:column>
      <f:facet name="header">Title</f:facet>
      <s:link id="event" value="#{event.title}" view="/event.xhtml">
      <f:param name="eventId" value="#{event.id}"/>
      </s:link>
      </h:column>
      <h:column>
      <f:facet name="header"></f:facet>
      <s:link id="event" value="Add Sub Event" view="/event.xhtml">
      <f:param name="parentId" value="#{event.id}"/>
      </s:link>
      </h:column>

      Above, first link works and eventId param is passed but the parentId param is not passed..

      So the question is how can I pass the event.id as a request parameter with a different name into XXXHome?

      Thanks.

        • 1. Re: EntityHome request parameter
          x y Newbie

          I was wrong in saying eventId param is passed.. It was passed initially during the creation of the instance but not when it was being saved.. I missed this little detail at 4am..

          I have found that the following is a solution, as documented in chapter 10.2

          @Factory("event")
          public Event initEvent() {
          return getInstance();
          }

          protected Event createInstance() {
          Event event = new Event();
          Event parent = getEntityManager().find(Event.class, Long.valueOf(parentId));
          event.setParent(parent);
          return event;
          }