Hello Chris! Well the thing is I used @persist just for that purpose, to save me from using the stale user object. There is some other issue around here which at this stage I can't figure out. :/
> Date: Thu, 27 Nov 2014 13:04:56 +1100 > Subject: Re: Issues with beaneditform component > From: ch...@opencsta.org > To: users@tapestry.apache.org > > On permission page I dont think u need @persist, you are setting the user > already. > > The reason: I think its because when it goes to save it is using the stale > user object discarding the form submission changes. > On 27/11/2014 12:45 pm, "Name Surname" <wintertime0...@outlook.com> wrote: > > > I have one very odd situation here and it regards beaneditform. I have > > implemented following code: > > > > > > public class ListUsers { > > > > @Inject > > private Logic logic; > > > > @InjectPage > > private PermissionsPage permissionsPage; > > > > > > @Property > > private User user; > > > > /** > > * Vraca listu korisnika > > * @return user list > > */ > > public List getUsers() > > { > > return logic.izlistajSveKorisnike(); > > } > > > > /** > > * Deletes user > > * @return null > > */ > > @CommitAfter > > public String onActionFromDelete(User u) > > { > > logic.deleteUser(u); > > return null; > > } > > > > /** > > * redirects to permissions page > > * @param k > > * @return page permissionspage > > */ > > public Object onActionFromEdit(User u) > > { > > permissionsPage.setData(u); > > return permissionsPage; > > } > > > > <t:layout t:pageTitle='${message:ListUsers}' xmlns:t=" > > http://tapestry.apache.org/schema/tapestry_5_3.xsd" > > xmlns:p="tapestry:parameter"> > > <t:form> > > <div class="grid-container"> > > <t:grid source="users" row="user" > > exclude="userID,userPassword,userTypeOfTheUser,listOfQuestions,listOfMessages, > > isAdmin, isUser" add="edit,delete"> > > > > <p:deletecell> > > <t:actionlink t:id="delete" context="user">Delete > > user</t:actionlink> > > </p:deletecell> > > <p:editcell> > > <t:actionlink t:id="edit" context="user">Edit > > permissions</t:actionlink> > > </p:editcell> > > </t:grid> > > </div> > > </t:form> > > </t:layout> > > > > > > > > Here I have a ListUsers page which has all users listed pulled from DB. > > > > > > Now when a client clicks on Edit permissions button of some user from the > > list it redirects him to a PermissionsPage which is following: > > > > <t:layout t:pageTitle='${message:PermissionsPages}' xmlns:t=" > > http://tapestry.apache.org/schema/tapestry_5_3.xsd"> > > <t:beaneditform t:id="form" object="user" > > exclude="userUserName,userPassword" submitlabel="Save"/> > > </t:layout> > > > > public class PermissionsPage { > > > > @Component > > private BeanEditForm form; > > @Inject > > private Logic logic; > > @Property > > @Persist(value = "flash") > > private User user; > > > > /** > > * After succesfully submitting from a form redirect a user to a page > > * ListClassesPage > > * > > * @return ListClassesPage > > */ > > @CommitAfter > > public String OnSuccess() { > > logic.editUser(user); > > return "ListClassesPage"; > > } > > > > /** > > * Sets user > > * @param u user > > */ > > public void setData(User u) { > > user = u; > > } > > } > > > > > > > > Now after I press Save, it fires event however doesn't process anything? > > Am I somewhere wrong? > > Also because of the issue regarding > > http://stackoverflow.com/questions/5366498/tapestry-5-beaneditform-component-trouble > > I had to remove all constructors from entity User but default one. If > > anyone knows or had similar trouble with this, would be grateful to hear > > his/her solution. > > > > Thanks in advance. > > > >