I am trying to preserve the components parameter values between event 
invocations by storing them in a map that gets passed to all my action links 
and forms.

I have added t:parameters="parms" to all my action links and see that in 
request object the parameters are set. However in the code below the presetup 
routine can get null values for the assoicated @Parameter members. On the first 
invocation of onActionFromTimeClicked the @Parameter members do get set but on 
subsequent invocations they become are null even though teh request passes 
values?

When I inspect the links in the browser the parameter values are all there. Why 
does the component sometimes not set parameters?

John


public class Diary {

    @Parameter
    private Integer workIdParm;
    @Parameter
    private Integer venueIdParm;
    @Parameter
    private Integer reservationIdParm;
    @Property
    private HashMap parms;
...


    private void presetup() {
        bookingForm.clearErrors();
        parms = new HashMap();
        parms.put("workIdParm", workIdParm);
        parms.put("venueIdParm", venueIdParm);
        parms.put("reservationIdParm", reservationIdParm);
        for (String pname : request.getParameterNames()) {
            log.debug("REQ: " + pname + "=" + request.getParameter(pname));
        }
        log.debug("preload:" + parms);
    }

    @SetupRender
    void setup() throws Exception {
        log.debug("setup diary parms=" + workIdParm + "," + venueIdParm + "," + 
reservationIdParm);
        Reservation reservation = null;
        if (reservationIdParm != null) {
            reservation = reservationFacade.getReservation(reservationIdParm);
            log.debug("load parms from reservation" + workIdParm + "," + 
venueIdParm);
        }
        presetup();
...
    }

    void onActionFromTimeClicked(long timeClicked) {
        presetup();
        startTimex = new Date(timeClicked);
        startDatex = new Date((startTimex.getTime() / TimeConstants.MS_DAY) * 
TimeConstants.MS_DAY);
        log.debug("selected " + new Date(timeClicked) + " " + startDatex);
        loadTimes(15);
        loadCallInTimes();
        ajaxResponseRenderer.addRender(timeZone).addRender(formZone);
    }

...
}

  ----- Original Message ----- 
  From: Thiago H de Paula Figueiredo 
  To: Tapestry users 
  Sent: Monday, December 02, 2013 3:59 PM
  Subject: Re: component paramter frustrations


  On Mon, 02 Dec 2013 12:14:39 -0200, John <j...@quivinco.com> wrote:

  > Yes that's right, my page is passing some key id values to deeper  
  > components, but the paramter value is lost after the intitial component  
  > render. That's my challenge.

  How are you updating the page after the initial render? Zone updates?  
  EventLink? Form? As Lance said, you should use the event context of  
  EventLink and ActionLink and even Form so you don't miss them.

  -- 
  Thiago H. de Paula Figueiredo
  Tapestry, Java and Hibernate consultant and developer
  http://machina.com.br
  Help me spend a whole month working on Tapestry bug fixes and  
  improvements: http://igg.me/at/t5month

  ---------------------------------------------------------------------
  To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
  For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to