crud dengan beaneditor tapestry5

File-file yang dibuat

Untuk MasterUser.tml :

<html     t:type="cetakan" title="Master User"

 <fieldset><legend>Master User</legend>


<t:beaneditor t:id="user" object="user"/>
 <t:submit t:id="save" t:value="Save/Update"/>
 <t:submit t:id="reset" t:value="Reset"/>
 <t:submit t:id="search" t:value="Search"/>
 <t:submit t:id="delete" t:value="Delete"/>


<t:grid source="listUser" row="userrow" add="del" reorder="del">
 <t:parameter name="delcell">
 <t:checkbox t:id="del" t:value="del"/>
 <t:parameter name="usernamecell">
 <t:actionlink t:id="edit" context="userrow.id_user">${userrow.username}</t:actionlink>


Sedangkan untuk :

package com.example.tutorial.pages.master;

import java.util.ArrayList;
 import java.util.List;

import org.apache.tapestry5.annotations.Persist;
 import org.apache.tapestry5.annotations.Property;

import com.example.tutorial.entities.User;
 import com.example.tutorial.util.TutorialUtil;

public class MasterUser {

 private User userRow;
 private User user;

private boolean del;

private List<User> listDelete;

private List<User> listUser = new ArrayList<User>();

void onSelectedFromSave(){
 if (getUser().getId_user() == null){


void onSelectedFromReset(){

void onSelectedFromDelete(){
 for(User u : getListDelete()){


void onSelectedFromSearch(){


void onActionFromEdit(String id_user){
 User u = new User();
 for (User usr : getListUser()){
 if (usr.getId_user().equals(id_user))
 u = usr;

void clear(){
 user = new User();

public User getUser() {
 if (user == null) user = new User();
 return user;

public void setUser(User user) {
 this.user = user;

public List<User> getListUser() {
 return listUser;

public void setListUser(List<User> listUser) {
 this.listUser = listUser;

public boolean isDel() {
 return del;

public void setDel(boolean del) {
 if (del){

public List<User> getListDelete() {
 if (listDelete == null) listDelete = new ArrayList<User>();
 return listDelete;

public void setListDelete(List<User> listDelete) {
 this.listDelete = listDelete;


Sedangkan untuk :

package com.example.tutorial.entities;

import org.apache.tapestry5.beaneditor.NonVisual;

public class User {

 private String id_user;

private String username;

private String password;

private Role role;

private boolean active;

private java.util.Date beginDate;

private java.util.Date expiredDate;

public String getId_user() {
 return id_user;

public void setId_user(String id_user) {
 this.id_user = id_user;

public String getUsername() {
 return username;

public void setUsername(String username) {
 this.username = username;

public String getPassword() {
 return password;

public void setPassword(String password) {
 this.password = password;

public Role getRole() {
 return role;

public void setRole(Role role) {
 this.role = role;

public boolean isActive() {
 return active;

public void setActive(boolean active) { = active;

public java.util.Date getBeginDate() {
 return beginDate;

public void setBeginDate(java.util.Date beginDate) {
 this.beginDate = beginDate;

public java.util.Date getExpiredDate() {
 return expiredDate;

public void setExpiredDate(java.util.Date expiredDate) {
 this.expiredDate = expiredDate;


dan :

package com.example.tutorial.entities;

public enum Role {



Published by


Begin a big Process with a bit trying

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s