tapestry-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ned Jackson Lovely <njl-tapes...@qu.to>
Subject Re: T5: Editing a db persisted object with BeanEditForm
Date Sat, 01 Sep 2007 14:19:45 GMT
On Fri, Aug 31, 2007 at 06:24:58PM +0300, Imants Firsts wrote:
> How do I correctly set up a BeanEditForm for editing a
> hibernate entity?

I don't think I'm even close to writing idiomatic Tapestry 5 (if such a
thing even exists), but here is the pattern I've been using:

public class EditMyBean {

	private MyDBClass _theBean;

	public MyDBClass getTheBean(){return _theBean;}

	public void onActivate(long id){
		_theBean = getDAO().getById(id);
	public long onPassivate(){
		return _theBean.getId();

        @Component(id = "beanEditForm")
        private BeanEditForm _beanEditForm;

	public void onValidate(){
		//Validate the changes. Add errors to the form using
		//_beanEditForm.recordError(String). This will automagically
		//cause the page to redisplay.

	public void onSuccess(){

<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">

<t:beaneditform object="theBean">
<t:parameter name="id">
<!-- Marking the getter or setter with @Nonvisual is far
   - preferable, but this will do in a pinch.



To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org

View raw message