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 } }