2007-05-29

SimpleTapestry 5 CRUD application - Step XY - BeanEditForm and Grid

I've modified UserAuthenticator (added a method for getting users list,

public
List getTUsersList();


and it's implementation into
UserAuthenticatorImpl

@SuppressWarnings("unchecked") //to avoid IDE's complaints)
public List getTUsersList() {

Session session = HibernateUtil.getSessionFactory().getCurrentSession();
session.beginTransaction();
List result = session.createQuery("from TUser").list();
session.getTransaction().commit();
return result;
}

)

added 2 new pages,

Registration (BeanEditForm example, ScreenCast #4)
the page duplicates in fact AddNew page functionality, was added just as an example of different approaches
Registration.html (submitLabel="Create" is not the same as in the screencast )and Registration.java

and

Home (Grid example, ScreenCast #5). The page purpose is a) to show an example of Grid component usage; b) The grid on the page must display all the registered users (that's why
getTUsersList() was added).

Home.html
I used
<t:parameter name="passwordCell">
*****
</t:parameter>

to hide
"password" column values (see next post for other way).

public class Home { @Inject private UserAuthenticator _authenticatior;
public List getUsersList()
{
return _authenticatior.getTUsersList(); }
}


Now, after successful login navigation goes to the Home (which displays existing users list):


There are still a lot of question and things-to-be-improved... .
7. SimpleTapestry 5 CRUD application -Step 07, Cancel button, variant 1.
6. SimpleTapestry 5 CRUD application -Step 06, tweaking a grid a bit.
5. Simple Tapestry 5 CRUD application - BeanEditForm and Grid screencasts aprobation.
4. SimpleTapestry 5 CRUD application -Step 04 Adding some basic Hibernate features into the project.
3. SimpleTapestry 5 CRUD application -Step 03, "user" bean creation.
2. SimpleTapestry 5 CRUD application -Step 02, adding a service.
1. SimpleTapestry 5 CRUD application -Step 01.



5 comments:

Kara Lee Jones said...

dont be so lazy on this one =P you should put up the steps on how to do this rather then redirect the user, not everything is the same, and had to extract the info from your src files.

Лозован Евгений said...

Well, you've persuaded me, wait a bit for additional details.

Kara Lee Jones said...

For some weird reason when you stop the application and restart jetty, the session doesn't seem to be commited. the data persists in the db until you access a method on any class which insititates a db session.

Kara Lee Jones said...

okay i figured that out, looks like its auto creating and overwriting the table again and again each time a session is established

have to remove

property name="hbm2ddl.auto"
create
property

in the hibernate.cfg.xml file. definatly should specific this in the tutorials for people without any knowledge on hibernate

Kara Lee Jones said...

the BeanEditForm component can have errors recorded to it as of tapestry version 5.0.5. The error you want to record should be Sorry, user name is already taken. choose another.