You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Warner Onstine <sw...@warneronstine.com> on 2004/02/17 15:20:32 UTC

crud example?

Hi all,
I am progressing nicely in my Tapestry learning thanks to the help from 
the list. Is there a CRUD (Create, Read, Update, Delete) example 
somewhere? I would like to be able to use the same form I use for 
inputting data as for editing the data.

Thanks!

-warner



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


Re: crud example?

Posted by Marilen Corciovei <le...@nemesisit.rdsnet.ro>.
Even if not updated or complete maybe you can find some inspiration
here:
http://nemesisit.rdsnet.ro/opendocs/tapehibe2/tapehibe2.html


len

On Tue, 2004-02-17 at 16:20, Warner Onstine wrote:

> Hi all,
> I am progressing nicely in my Tapestry learning thanks to the help from 
> the list. Is there a CRUD (Create, Read, Update, Delete) example 
> somewhere? I would like to be able to use the same form I use for 
> inputting data as for editing the data.
> 
> Thanks!
> 
> -warner
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 

Re: crud example?

Posted by Warner Onstine <sw...@warneronstine.com>.
Thanks both of you!

-warner

On Feb 17, 2004, at 8:40 AM, Eric Schneider wrote:

> Warner,
>
> There is a Tapestry/Cayenne web app example bundled with Cayenne.  Of
> course, this example requires the use of Cayenne, which is a O/R 
> framework
> (CRUD done easy).
>
> Have a look if you are interested.
>
> http://www.objectstyle.org/cayenne/index.html
>
> e.
>
> ----- Original Message -----
> From: "Warner Onstine" <sw...@warneronstine.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Tuesday, February 17, 2004 9:20 AM
> Subject: crud example?
>
>
>> Hi all,
>> I am progressing nicely in my Tapestry learning thanks to the help 
>> from
>> the list. Is there a CRUD (Create, Read, Update, Delete) example
>> somewhere? I would like to be able to use the same form I use for
>> inputting data as for editing the data.
>>
>> Thanks!
>>
>> -warner
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>



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


Re: crud example?

Posted by Eric Schneider <er...@centralparksoftware.com>.
Warner,

There is a Tapestry/Cayenne web app example bundled with Cayenne.  Of
course, this example requires the use of Cayenne, which is a O/R framework
(CRUD done easy).

Have a look if you are interested.

http://www.objectstyle.org/cayenne/index.html

e.

----- Original Message ----- 
From: "Warner Onstine" <sw...@warneronstine.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, February 17, 2004 9:20 AM
Subject: crud example?


> Hi all,
> I am progressing nicely in my Tapestry learning thanks to the help from
> the list. Is there a CRUD (Create, Read, Update, Delete) example
> somewhere? I would like to be able to use the same form I use for
> inputting data as for editing the data.
>
> Thanks!
>
> -warner
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


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


Re: crud example?

Posted by Jeff Emminger <je...@jeffemminger.com>.
Hi Warner,

The wiki has an example of this in the Tapestry/Hibernate app by Marilen 
Corciovei (I think).  I can't get to the wiki to verify this though.

I built a small app using the aforementioned app as an example, and here 
are some snippets that might help you.  It is a guestbook where users 
can add/update/delete guestbook entries.  There is only one form, 
Add.html/Add.page, which is reused in .application as "Add", "Update" 
and "Delete".

*** form listener from Add.java:

	public void submit(IRequestCycle cycle) {
		try {
			Session sess = null;
			Transaction tx = null;
			try {
				sess = getSession();
				tx = sess.beginTransaction();

				if ("Add".equalsIgnoreCase(getPageName()))
					sess.save(entry);
				else if ("Update".equalsIgnoreCase(getPageName()))
					sess.update(entry);
				else if ("Delete".equalsIgnoreCase(getPageName()))
					sess.delete(entry);
					
				tx.commit();
				cycle.activate("Home");
			} catch (Exception e) {
				e.printStackTrace();
				tx.rollback();
			} finally {
				if (sess != null) {
					sess.flush();
					sess.close();
				}
			}
		} catch (HibernateException e) {
			e.printStackTrace();
		}
	}

*** from .application:
     <page name="Add" specification-path="Add.page"/>
     <page name="Update" specification-path="Add.page"/>
     <page name="Delete" specification-path="Add.page"/>


HTH
Jeff




Warner Onstine wrote:
> Hi all,
> I am progressing nicely in my Tapestry learning thanks to the help from 
> the list. Is there a CRUD (Create, Read, Update, Delete) example 
> somewhere? I would like to be able to use the same form I use for 
> inputting data as for editing the data.
> 
> Thanks!
> 
> -warner
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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