RE: hivemind create-instance and additionnal parameters
1) 2) Create a class that implements org.apache.tapestry.engine.state.StateObjectFactory with this signature: public Object createStateObject() { // create your Hangman here } public void setServletContext(ServletContext context) { this.context = context; } Hope this helps, -Original Message- From: Cyrille37 [mailto:[EMAIL PROTECTED] Sent: Thursday, December 21, 2006 12:32 PM To: Tapestry users Subject: hivemind create-instance and additionnal parameters Hi, I know I'm noisy on this list with my beginner's questions. Sorry for that, but it is not so easy to swallow all Tapestry's stuff. by the way, here is my new question: I would like to add a Session object. This config wroks nice. Now I would like to pass a parameter or set a property to that object (like i use to do with Spring). In the object's class (games.hangman.service.Hangman) I would like to inject the ServletContext. With Annotation I could do like : @InjectObject("service:tapestry.globals.ServletContext") public abstract ServletContext getServletContext(); But I do not want to use Annotation. so I would like to add this ServletContext in the previous state-object/create-instance definition. I'd a look at documentation (http://hivemind.apache.org/descriptor.html) but I did not find the right way. Thanks for your help. cyrille - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: hivemind create-instance and additionnal parameters
In order to inject a property into an ASO, you need to implement a custom org.apache.tapestry.engine.state.StateObjectFactory. (There are numerous post in the archive on this.) The following in the wiki has an example. http://wiki.apache.org/tapestry/InjectPropertyIntoASO The above example does not do exactly what you wanted. But it is a start. HTH Shing --- Cyrille37 <[EMAIL PROTECTED]> wrote: > Hi, > > I know I'm noisy on this list with my beginner's > questions. Sorry for > that, but it is not so easy to swallow all > Tapestry's stuff. > by the way, here is my new question: > > I would like to add a Session object. This config > wroks nice. > configuration-id="tapestry.state.ApplicationObjects"> > scope="session" > > class="games.hangman.service.Hangman" /> > > > Now I would like to pass a parameter or set a > property to that object > (like i use to do with Spring). > In the object's class > (games.hangman.service.Hangman) I would like to > inject the ServletContext. > With Annotation I could do like : > > @InjectObject("service:tapestry.globals.ServletContext") > public abstract ServletContext > getServletContext(); > But I do not want to use Annotation. > > so I would like to add this ServletContext in the > previous > state-object/create-instance definition. I'd a look > at documentation > (http://hivemind.apache.org/descriptor.html) but I > did not find the > right way. > > Thanks for your help. > cyrille > > > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > Home page : http://uk.geocities.com/matmsh/index.html Send instant messages to your online friends http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]