You can't use 'getValueForKey(for_value)' in a template

Here is how I would do it

<t:loop source='keys' value='key'>
   <t:textfield t:value='value'/>
</t:loop>

private Map<String, String> something;

@Property
private String key;

public Set<String> getKeys(){
   //Somehow you have already loaded the map
   return something.keySet();//keys
}

public String getValue(){
   return something.get(key);
}

public void setValue(String value){
   something.put(key, value);
}

regards
Taha


On Wed, May 4, 2011 at 6:52 PM, bogdan_cm <bogdan.iva...@rbccm.com> wrote:

> Hi all,
>   I have a textfield component inside a loop. The value of the text
> component is set like this:
>  <t:textfield t:value="getValueForKey(for_value)"></t:textfield>
>
> The entire loop is enclosed in a <form>. When i try to submit the form, I
> get the following error:
>
> An exception has occurred: Failure writing parameter 'value' of component
> Index:textfield: Expression 'getValueForKey(for_value)' for class
> com.example.tutorial.pages.Index is read-only
>
>
> My Java class does contain a setter method:
>
>        public String getValueForKey(String key) {
>                return arUser.getValueForKey(key);
>        }
>
>        public void setValueForKey(String key) {
>                System.out.println("DO NOTHING");
>        }
>
> The only funny thing i'm doing here is that the java class does not have a
> property "per se", only getter and setter methods.
>
> Thanks very much,
> Bogdan.
>
>
>
>
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/getter-setter-for-textfield-component-tp4369806p4369806.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to