Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Issues with beaneditform component

$
0
0
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.

Viewing all articles
Browse latest Browse all 5648

Trending Articles