You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jesse Merriman <je...@warpmail.net> on 2007/10/15 04:41:06 UTC

Binding to sub-properties

(Tapestry newb, using 4.1.3, maybe answered before but I couldn't find it.)

Is it possible to bind to a sub-property? Eg, this works:

  Home.html:
  <input jwcid="@TextField" value="ognl:num" />

  Home.java:
  public abstract class Home extends BasePage implements PageBeginRender {
    public abstract int getNum();
    public abstract void setNum(int num);
    ...
  }

This does not work:

  Home.html:
  <input jwcid="@TextField" value="ognl:foo.num" />
    or
  <input jwcid="@TextField" value="ognl:getFoo().num" />

  public abstract class Home extends BasePage implements PageBeginRender {
    public abstract Wrapper getFoo();
    public abstract void setFoo(Wrapper wrap);
    ...
  }

  public class Wrapper {
    private int num;
    public int getNum() { return num; }
    public void setNum(int n) { num = n; }
  }

The reason I'd like to do this is to collect the values of a number of <input>s
into one object to simplify some other areas of code.

Thanks,
Jesse

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Binding to sub-properties

Posted by andyhot <an...@di.uoa.gr>.
they should both work,
what's the error you're getting?



Jesse Merriman wrote:
> (Tapestry newb, using 4.1.3, maybe answered before but I couldn't find it.)
>
> Is it possible to bind to a sub-property? Eg, this works:
>
>   Home.html:
>   <input jwcid="@TextField" value="ognl:num" />
>
>   Home.java:
>   public abstract class Home extends BasePage implements PageBeginRender {
>     public abstract int getNum();
>     public abstract void setNum(int num);
>     ...
>   }
>
> This does not work:
>
>   Home.html:
>   <input jwcid="@TextField" value="ognl:foo.num" />
>     or
>   <input jwcid="@TextField" value="ognl:getFoo().num" />
>
>   public abstract class Home extends BasePage implements PageBeginRender {
>     public abstract Wrapper getFoo();
>     public abstract void setFoo(Wrapper wrap);
>     ...
>   }
>
>   public class Wrapper {
>     private int num;
>     public int getNum() { return num; }
>     public void setNum(int n) { num = n; }
>   }
>
> The reason I'd like to do this is to collect the values of a number of <input>s
> into one object to simplify some other areas of code.
>
> Thanks,
> Jesse
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
>   

-- 
Andreas Andreou - andyhot@apache.org - http://andyhot.di.uoa.gr
Tapestry / Tacos developer
Open Source / JEE Consulting


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org