Re: creating components with Tapestry 5
Hello Marc, me, I'm another one seeking for good old WebObjects features in the post Apple world ... unfortunately, my company is completely on JSF trip, which I absolutely dislike. But on to your question: is WOComponentContent. That was simple wasn't it? :-) Marcus. 2007/9/23, Marc A. Donis <[EMAIL PROTECTED]>: > Hi everyone, > > First off, I am new to Tapestry, although I've been doing WebObjects for > about 8 years, so the I'm hoping the transition won't be too painful. I've > chosen to work with Tapestry 5 since it seems like quite a signifiicant > evolution from the previous version, but I'm having some difficulty finding > resoureces. I've done the excellent Tapestry 5 tutorial, but I need much > more input! Can anybody point me to some useful places. I am especially > interested in words of wisdom regarding use of Tapestry and Cayenne together > (which I am also learning). > > My current issue is trying to understand how to create a page wrapper > component (or any sort of component, actually) in Tapestry 5 -- something > like the old WOComponentContent, which I know and love. > > tia, > Marc > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: redirecting page under onActivate
Just return null. On 9/19/07, Angelo Chen <[EMAIL PROTECTED]> wrote: > > Hi Josh, > > Thanks, it works, a related question, how to redirect the page to the one > calling? sometimes we don't know which one is "calling page", so we can't > use page class/name to redirect, any idea? Thanks. > A.C. > > > Josh Canfield-2 wrote: > > > > You can return an object that represents the page you want to redirect to. > > The allowed objects are described here: > > http://tapestry.apache.org/tapestry5/tapestry-core/guide/pagenav.html > > > > Josh > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3A-redirecting-page-under-onActivate-tf4479292.html#a12773205 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: [T5] Tomcat and source path
Hello, have a look at http://tapestry.apache.org/tapestry5/tomcat.html. Perhaps it helps. Marcus. Hibowl Kopie: Thema:[T5] Tomcat and source path 10.09.2007 16:37 Bitte antworten an "Tapestry users" Hi, i'm new to T5, and I would like to have such a source path : src/myapp instead of src/main/java/myapp. I built my project with Maven and quickstart. I managed to run it on Jetty, but can't find a way to do this with Tomcat. When I deploy the war created by maven on Tomcat, it don't find my application. I think Tomcat can't find the java files because they are not where they must be for Maven... Perhaps should I use another artifact as quickstart ?? Or change anything in configuration. Has anyone any advice ? Thank you ! -- View this message in context: http://www.nabble.com/-T5--Tomcat-and-source-path-tf4415149.html#a12594078 Sent from the Tapestry - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ prosystems IT GmbH Anwendungsentwicklung Postfach 31 51 53021 Bonn (Germany) Tel: 0228 / 3366 - 3329, Fax: 0228 / 3366 - 73329 mailto:[EMAIL PROTECTED] http://www.prosystemsIT.de Amtsgericht Bonn - HR B 13189 Geschaeftsfuehrer: Vassilios Timiliotis, Richard Adams Der Austausch von Nachrichten mit der prosystems IT GmbH via E-Mail dient ausschliesslich Informationszwecken. Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht ausgetauscht werden. Verfaelschungen des urspruenglichen Inhaltes dieser Nachricht bei der Datenuebertragung koennen nicht ausgeschlossen werden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: Re: T5: Hibernate
Hi Angelo, yes ... the service you get from tapestry-hibernate is not mainly just reading the config. This is simple, you could do it yourself, this is just an additional benefit. The main service you get is that sessions and transactions are openend, closed and committed (hopefully even rolled back in case of exception) at the right moment during request processing so that you don't have to care about. Manually commiting a transaction though causes an error when tapestry tries his automatic commit. Have fun! Marcus. Angelo Chen <[EMAIL PROTECTED]An: users@tapestry.apache.org hoo.com.hk> Kopie: Thema:Re: T5: Hibernate 10.09.2007 12:18 Bitte antworten an "Tapestry users" Hi Davor, Never mind the question, the error comes from a invalid table name, I forgot it's case senstive. I'd like to now if can use the transaction normally, like: Transaction tx = _session.beginTransaction(); List fruits = _session.createQuery("from Fruit f order by id").list(); System.out.println(fruits.size() + " found"); tx.commit(); the commit will have an excpetion: [WARN] ThreadCleanupHub Error invoking listener [EMAIL PROTECTED]: Transaction not successfully started org.hibernate.TransactionException: Transaction not successfully started _ prosystems IT GmbH Anwendungsentwicklung Postfach 31 51 53021 Bonn (Germany) Tel: 0228 / 3366 - 3329, Fax: 0228 / 3366 - 73329 mailto:[EMAIL PROTECTED] http://www.prosystemsIT.de Amtsgericht Bonn - HR B 13189 Geschaeftsfuehrer: Vassilios Timiliotis, Richard Adams Der Austausch von Nachrichten mit der prosystems IT GmbH via E-Mail dient ausschliesslich Informationszwecken. Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht ausgetauscht werden. Verfaelschungen des urspruenglichen Inhaltes dieser Nachricht bei der Datenuebertragung koennen nicht ausgeschlossen werden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
Hi, it's jta.jar which comes with Hibernate. In Eclipse, make an additional project containing all jars you have. So you can always search for any class using Ctrl-Shift-T finding the right jar for it an add it to the project. Even better: You can also make a function less class in your project like follows: import javax.transaction.Synchronization; public class Imports { Synchronization a; } For the application without any funktion, just to document all the ClassNotFoundExceptions you faced. If you get another ClassNotFound, just add the not-found-class to your "Imports" class. There will be two errors displayed in Eclipse. Go to the (erroneous) import statement, Press Ctrl-1 and select "Add jar to project build path". A very simple way to document which jars are needed and to get them into the project. Marcus. > javax/transaction/Synchronization, any idea what package contains this? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
Angelo, here is mine, really basic, but it works: http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";> com.mysql.jdbc.Driver jdbc:mysql://192.168.0.102:3306/marcus marcus 1 org.hibernate.dialect.MySQL5Dialect thread org.hibernate.cache.NoCacheProvider true update Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
I cannot really tell what the error is, but I am also a beginner and also started with an existing Hibernate configuration the same way as you did, so it will be only a small mistake. One thing I think is important is that Tapestry Hibernate automatically configures all @Entity classes in the "entities" package. So I think you have to remove the "mapping" entry in the hibernate-config. Either an entity is configured by hibernate config or programatically (by tapestry in this case), but not both. Marcus. 2007/9/10, Angelo Chen <[EMAIL PROTECTED]>: > > Hi Davor, > > I read the doc and do the following: > > 1. put Fruit.java under entities package > 2. put hibernate.cfg.xml under resources > 3. in the Start.java, I add: > @Inject private Session _session; > > String onAction() { > Fruit f = new Fruit(); > f.setName("Orange"); > f.setPrice(10); > _session.save(f); > _session.close(); > return null; } > > I got following error: > > The content of element type "session-factory" must match > "(property*,mapping*,(class-cache|collection-cache)*,event*,listener*)". > > here are the related files: > > Fruit.java > package org.bfe.hbm.entities; > import javax.persistence.*; > @Entity > @Table(name="Fruit") > public class Fruit { > @Id @GeneratedValue > private long id; > private String name; > private int price; > public long getId() { > return id;} > public void setId(long id) { > this.id = id;} > public String getName() { > return name; > } > public void setName(String name) { > this.name = name;} > public int getPrice() { > return price;} > public void setPrice(int price) { > this.price = price;} > } > > hibernate.cfg.xml:(note: this is taken from a working app, except changed > mapping class from xml to anotated) > > > "-//Hibernate/Hibernate Configuration DTD 3.0//EN" > "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd";> > > > > > > > > > > name="connection.driver_class">com.mysql.jdbc.Driver > name="connection.url">jdbc:mysql://localhost/animal > root > > > > 1 > > > name="dialect">org.hibernate.dialect.MySQLDialect > > > thread > > > name="cache.provider_class">org.hibernate.cache.NoCacheProvider > > > true > > >create - > > > > > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
Still not in bed .. was too curious about that session thing. Adding this parameter indeed works - I get some kind of session object in the contribute method. But what session is this? Is it a session which is created at this moment (and is already closed when I really need it) or is it some kind of proxy which always points to the session which is active in the moment I need it? Marcus. 2007/9/10, Marcus Schmidke <[EMAIL PROTECTED]>: > Ok ..., > > I took a shower which made things much much clearer. > > I think I should build and register a BusinessService (just like a > stateless session bean) which encapsulates the Hibernate things. This > Service can have the Hibernate Session injected on some different ways > (just like explained in the document you mentioned), and my value > encoder can make use of this service (I tried to add the service as > parameter to the contributeValueEncoderSource method, and damn! it > worked). > > Great, all this seems to work now. Was not too complicated, perhaps > only too late for me. Time to go to bed. > > Have a good night! > > Marcus. > > PS. I'm just thinking about what had happened if I had added a > Hibernate Session parameter to contributeValueEncoderSource's > parameter list? Perhaps this would have worked either? > > > 2007/9/10, Marcus Schmidke <[EMAIL PROTECTED]>: > > Yes ... I've read ... parts of it more than once ... but > > unfortunately, I do not seem to be clever enough. > > > > I want to write a value encoder which maps Hibernate Entities to their > > IDs and vice versa. > > > > I've written > > - a HibernateValueEncoder > > - a HibernateValueEncoderFactory > > - an AppModule containing the following: > > > > public static void > > contributeValueEncoderSource(MappedConfiguration, > > ValueEncoderFactory> configuration) { > > configuration.add(ObjektMitSeqID.class, new > > HibernateValueEncoderFactory()); > > } > > > > (where ObjektMitSeqID is the base class of all of my Hibernate Entities). > > > > This all works fine, no problem, but only as long as I use my own > > HibernateUtil to create a Session. But I would prefer using tapestry > > to create the Hibernate Session. > > > > Since I don't create a service on my own, but only contribute > > configuration to an existing service, I have absolutely no plan how or > > where to inject the Hibernate Session. > > > > Perhaps I'm a little bit confused. I don't know. Do you have another hint? > > > > > > Marcus. > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
Ok ..., I took a shower which made things much much clearer. I think I should build and register a BusinessService (just like a stateless session bean) which encapsulates the Hibernate things. This Service can have the Hibernate Session injected on some different ways (just like explained in the document you mentioned), and my value encoder can make use of this service (I tried to add the service as parameter to the contributeValueEncoderSource method, and damn! it worked). Great, all this seems to work now. Was not too complicated, perhaps only too late for me. Time to go to bed. Have a good night! Marcus. PS. I'm just thinking about what had happened if I had added a Hibernate Session parameter to contributeValueEncoderSource's parameter list? Perhaps this would have worked either? 2007/9/10, Marcus Schmidke <[EMAIL PROTECTED]>: > Yes ... I've read ... parts of it more than once ... but > unfortunately, I do not seem to be clever enough. > > I want to write a value encoder which maps Hibernate Entities to their > IDs and vice versa. > > I've written > - a HibernateValueEncoder > - a HibernateValueEncoderFactory > - an AppModule containing the following: > > public static void > contributeValueEncoderSource(MappedConfiguration, > ValueEncoderFactory> configuration) { > configuration.add(ObjektMitSeqID.class, new > HibernateValueEncoderFactory()); > } > > (where ObjektMitSeqID is the base class of all of my Hibernate Entities). > > This all works fine, no problem, but only as long as I use my own > HibernateUtil to create a Session. But I would prefer using tapestry > to create the Hibernate Session. > > Since I don't create a service on my own, but only contribute > configuration to an existing service, I have absolutely no plan how or > where to inject the Hibernate Session. > > Perhaps I'm a little bit confused. I don't know. Do you have another hint? > > > Marcus. > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
Yes ... I've read ... parts of it more than once ... but unfortunately, I do not seem to be clever enough. I want to write a value encoder which maps Hibernate Entities to their IDs and vice versa. I've written - a HibernateValueEncoder - a HibernateValueEncoderFactory - an AppModule containing the following: public static void contributeValueEncoderSource(MappedConfiguration, ValueEncoderFactory> configuration) { configuration.add(ObjektMitSeqID.class, new HibernateValueEncoderFactory()); } (where ObjektMitSeqID is the base class of all of my Hibernate Entities). This all works fine, no problem, but only as long as I use my own HibernateUtil to create a Session. But I would prefer using tapestry to create the Hibernate Session. Since I don't create a service on my own, but only contribute configuration to an existing service, I have absolutely no plan how or where to inject the Hibernate Session. Perhaps I'm a little bit confused. I don't know. Do you have another hint? Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Hibernate
I accidentally found this thread and also tried to get Hibernate integration running. Basically, it runs, but I still know too few about Tapestry basics. @Inject works fine for page components, but how can I make it work in other classes? Concretely, how can I inject a hibernate session into my ValueEncoder? Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Two simple questions
Filip, thank you - (2) is perfect. I would never had guessed that. I tried onAction... and onSubmit ... Did I miss some documentation, or is it simply not documented so far? But (1) I still don't understand. Where do I have to put this method? Marcus. 2007/9/8, Filip S. Adamsen <[EMAIL PROTECTED]>: > 1: > > public static void contributeValueEncoderSource( > MappedConfiguration configuration) { >configuration.add(Your.class, new YourValueEncoderFactory()); > } > > 2: > > onSelectedFromX if I recall correctly. > > -Filip > > Marcus Schmidke skrev: > > Hello all, > > > > I'm sorry I am really having problems to find the documentation for > > the simplest things. Please forgive me having another two RTFM > > questions: > > > > 1. How can I register a ValueEncoderFactory application wide so that > > it is automatically used? In other words, how do I "contribute a > > org.apache.tapestry.services.ValueEncoderFactory into the service's > > configuration" (these are the words from the doc I simply don't > > understand) > > > > 2. Which is the right way to write ActionMethods for different Submit > > Buttons in the form? I tried "onActionFromX", with t:id="X" (and many > > variants), but nothing worked. > > > > Please help!! :-) > > > > Marcus. > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: @Parameter writes into the field without using the setter method?
Hello, I've written a component which has a parameter field marked as "@Parameter". This works fine, but if I try to do some other work in the setter method for this parameter, I can see that it isn't called. Trying to put @Parameter annotation on the method fails because it's a field annotation. Shouldn't, if present, the setter be used instead of directly writing into the field? Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Two simple questions
Hello all, I'm sorry I am really having problems to find the documentation for the simplest things. Please forgive me having another two RTFM questions: 1. How can I register a ValueEncoderFactory application wide so that it is automatically used? In other words, how do I "contribute a org.apache.tapestry.services.ValueEncoderFactory into the service's configuration" (these are the words from the doc I simply don't understand) 2. Which is the right way to write ActionMethods for different Submit Buttons in the form? I tried "onActionFromX", with t:id="X" (and many variants), but nothing worked. Please help!! :-) Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5: Troubles editing a list of objects
Nick, that was really simple ... and works fine, thank you. But I must admit that I don't understand what I'm doing here (even reading the documentation about loop.volatile did not help me, sorry). What is volatile's default for? I understood so far: Having volatile=default causes serialization of the displayed objects during render. To where? I suppose it's that long long long long invisible field at the beginning of the form? Ok. Later, on request processing, the objects get deserialized from the form, and then, the input values are applied. But what is the intended way to deal with those deserialized objects? They are referenced from nowhere in my code. How can I access the changed values? Marcus. 2007/9/6, Nick Westgate <[EMAIL PROTECTED]>: > Use: > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
T5: Troubles editing a list of objects
Hello all, the following might be an absolute beginner's error, but since I'm an absolute beginner, I probably am allowed to have this kind of problem ... I'm trying to edit a list of values: class Value { String name; String text; boolean used; ... getters ... ... setters ... } class Page { private @Persist List values; private Value value; //iterator ... getters / setters ... ... some code to initialize values list ... } And the html code: ${value.name} The page is rendered perfectly. On Submit, the new values are passed into some Value objects. But: those Value objects are serialized/deserialized instances of the original Value objects. While the List still holds the original Value objects, only copies of them get modified. Result is that my program code (which works on the list) never sees the modified versions, and on re-rendering, the old values are displayed again. What am I doing wrong?? Marcus. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Anybody's developing "object oriented"?
Hello all, I'm in the unlucky situation that I have to give up working with my favourite Web Framework - Apple's WebObjects - in favor to something that is more J2EE-homed and more open source (seems that WO will be this too at some time, but even then - no chance) and more portal-ready. Perhaps I will be forced to use JSF, but if I have some good arguments, perhaps there is a small chance to push some other framework - Tapestry, for example. I've experimented a little with JSF and was totally disappointed. The main things I missed comparing to my previous-millennium-framework were: - working iterators, especially with a dynamic number of input fields and buttons in the iterator body - object oriented developing - component oriented developing "Object oriented developing" means: imagine a list of objects I want to display in a list box. I want to write a method which extracts a displayable string, but that's already all. I think it's the framework's problem to generate HTML-able VALUE-Strings and to convert those strings back to objects. My previous millennium framework had absolutely no problem doing this for me - it simply numbered the elements and the only thing I had to do is to make sure that the Collection of objects was the same at the beginning of the next action request. Frustrated like this I had a look at Tapestry, which was invented in memory of WebObjects. Most of my JSF-problems seem to have a Tapestry-solution, that's fine. But, oh no, what is this "ValueEncoder"-thing??? Don't say it is what I'm afraid of it might be ... Any comments? Regards, Marcus. _ prosystems IT GmbH Anwendungsentwicklung Postfach 31 51 53021 Bonn (Germany) Tel: 0228 / 3366 - 3329, Fax: 0228 / 3366 - 73329 mailto:[EMAIL PROTECTED] http://www.prosystemsIT.de Amtsgericht Bonn - HR B 13189 Geschaeftsfuehrer: Vassilios Timiliotis, Richard Adams Der Austausch von Nachrichten mit der prosystems IT GmbH via E-Mail dient ausschliesslich Informationszwecken. Rechtsgeschaeftliche Erklaerungen duerfen ueber dieses Medium nicht ausgetauscht werden. Verfaelschungen des urspruenglichen Inhaltes dieser Nachricht bei der Datenuebertragung koennen nicht ausgeschlossen werden. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]