After making the EfiUser persist in the UserEdit.page the edit works fine but after editing one user if I want to add a new user then the page get populated the previous user. I’m setting user to the EditUser page only in edit action. But in new action I’m not setting any user but still it is getting the previous user. Note I’m using same page for add and update.
There must be something that I’m doing wrong in pageBeginRender method. please look at the following code below? UserListActive page invoke the action below and set the user to the UserEdit page accordingly: public void userNewAction(IRequestCycle cycle) { UserEdit nextPage = (UserEdit) cycle.getPage("UserEdit"); nextPage.setUserId(0); nextPage.setNewUser(true); cycle.activate(nextPage); } public void userEditAction(IRequestCycle cycle) { UserEdit nextPage = (UserEdit) cycle.getPage("UserEdit"); Object[] parameters = cycle.getServiceParameters(); int id = ((Integer) parameters[0]).intValue(); EfiUser user = EfiUserDAO.getEfiUserById(id); nextPage.setUser(user); nextPage.setNewUser(false); cycle.activate(nextPage); } Page spec: <property-specification name="user" type="com.fujitsu.efi.infringement.model.EfiUser" persistent="yes"/> UserEdit page: public void pageBeginRender(PageEvent event) { if (!getNewUser() && !event.getRequestCycle().isRewinding()) { EfiUser user = getUser(); setActiveDate(getUser().getUsrActiveDate().getTime()); if (getUser().getUsrExpiryDate() != null) { setExpiryDate(getUser().getUsrExpiryDate().getTime()); } } else { userLoggedIn = AuthorisationUtil.getNormalisedRemoteUserName(event); if (getUser() == null) { setUser(new EfiUser()); } } } Thanks Naz Nick Westgate wrote: > > How is the User object persisted? > (What relates to it in your UserEdit.page file?) > > Cheers, > Nick. > > > Nazmul Bhuiyan wrote: >> I’m loosing the User object as soon as the edit action is invoked? >> >> I’m setting an object (e.g. User) in page UserMaint.java to the page >> UserEdit.java. >> >> UserMaint.java >> >> public void userEditAction(IRequestCycle cycle) { >> UserEdit nextPage = (UserEdit) cycle.getPage("UserEdit"); >> Object[] parameters = cycle.getServiceParameters(); >> int id = ((Integer) parameters[0]).intValue(); >> >> EfiUser user = EfiUserDAO.getEfiUserById(id); >> >> nextPage.setUser(user); >> nextPage.setNewUser(false); >> cycle.activate(nextPage); >> } >> >> In pageBeginRender method of UserEdit shows the User object with all the >> attributes: >> >> UserEdit.java >> >> public abstract void setUser(EfiUser user); >> public abstract EfiUser getUser() >> >> public void pageBeginRender(PageEvent event) { >> >> if (!getNewUser() && !event.getRequestCycle().isRewinding()) { >> >> System.out.println("Inside pageBeginRender.................."); >> System.out.println("user: " + getUser()); >> System.out.println("ID: " + getUser().getUsrUserId()); >> . >> . >> etc >> } >> } >> >>>From Debug: >> Inside pageBeginRender.................. >> user: [EMAIL PROTECTED] >> ID: 1 >> >> But in the updateUser method the User object is different and the fields >> I >> don’t want to update are null. >> >> UserEdit.java >> >> public void updateUser(IRequestCycle cycle) { >> System.out.println("In updateUser"); >> >> IValidationDelegate delegate = getValidationDelegate(); >> >> //HibernateUtil.restartSession(); >> >> System.out.println("Inside updateUser.................."); >> System.out.println("user: " + getUser()); >> System.out.println("ID: " + getUser().getUsrUserId()); >> . >> . >> etc >> } >> >>>From Debug: >> Inside updateUser.................. >> user: [EMAIL PROTECTED] >> ID: 0 >> >> Please help. >> >> Naz > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/T3%3A-loosing-the-User-object-as-soon-as-the-edit-action-is-invoked--tf4133892.html#a11804499 Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]