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*

Reply via email to