Muhammad, Thanks for the reply! I did clean an rebuild the project. Also, I used the event handler onPrepareFromMyBeanEditor() method, and as I wrote in my original post, my bean is instantiated twice with parameters, and is finally instantiated one more time without parameters.
No matter what I did using the approaches described in the FAQ, Tapestry forced a no-param constructor. Another list member wrote to me off-list and suggested I simply instantiate the bean in the onActivate() method. I did that, and now everything works: the constructor is called exactly once with the proper parameters. Which leaves me still wondering what exactly is going on with the examples in the FAQ! -George On Tue, Oct 4, 2011 at 2:38 PM, Muhammad Gelbana <m.gelb...@gmail.com> wrote: > 2 Suggestions: > > 1. Have you tried cleaning your project and re-building it ? Restarting the > server on which you are developing ? > 2. Why don't you construct the bean yourself ? Add an event handler method > to handle the "PREPARE" event of form embracing your bean editor. > > On Tue, Oct 4, 2011 at 4:21 AM, George Ludwig <georgelud...@gmail.com>wrote: > >> I've got a bean that reads/writes to the file system. To do that, it's >> constructor takes a param for the file path. Very straightforward, however >> using this bean has been problematic. I got the "no service implements the >> interface String" exception when constructing the bean, which led me to the >> FAQ here: http://tapestry.apache.org/beaneditform-faq.html However, things >> do not work as advertised in the FAQ. >> >> No matter what I do, Tapestry requires that the bean have a no argument >> constructor, and that I annotate that constructor with @Inject. And in the >> debugger I see that the parameterized constructor is called twice >> from onPrepareFromMyBeanEditor(), after which the no-param constructor is >> called. >> >> At the time the page renders, my bean lacks a filepath, I assume because >> the >> last time the constructor was called, it had no parameters. >> >> Summary: >> Bean constructors are called multiple times, twice with params and once >> without, always resulting in a bean that has been created with no >> parameters. >> >> What can I do here? I've included hacked version of the FAQ code with >> notes. >> >> Best, >> >> George >> >> public class MyBean { >> @Inject <------------------------------ without this annotation >> on the no-param constructor, Tapestry always throws a "no service ..." >> exception >> public MyBean() { ... } >> public MyBean(String filePath) { ... } >> } >> >> public class MyPage { >> @Property >> public MyBean myBean; <--------------- the example code declares this as >> public, but Tapestry throws an exception, insisting it be made private...is >> this possibly related to the problem I'm seeing? >> void onPrepareFromMyBeanEditor() { >> myBean = new MyBean(getFilePath()); <------------------- I need a param >> to point to the file, but can't seem to hang on to the bean that is >> instantiated here >> } >> } >> > > > > -- > *Regards,* > *Muhammad Gelbana > Java Developer* > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org