Re: T5 Loop Issue

2010-05-28 Thread Thiago H. de Paula Figueiredo

On Fri, 28 May 2010 19:41:45 -0300, Norman Franke nor...@myasd.com wrote:

Since I re-populate the list in the onPrepare() call, I'm not sure why  
it's doing this. The volatile option is not use anywhere, and if I  
tried, I get a NPE anyway.


Loop's volatile parameter is deprecated. Use formState=none instead.

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,  
and instructor

Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

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



Re: T5 Loop Issue

2010-05-28 Thread Norman Franke

On May 28, 2010, at 9:15 PM, Thiago H. de Paula Figueiredo wrote:

On Fri, 28 May 2010 19:41:45 -0300, Norman Franke nor...@myasd.com  
wrote:


Since I re-populate the list in the onPrepare() call, I'm not sure  
why it's doing this. The volatile option is not use anywhere, and  
if I tried, I get a NPE anyway.


Loop's volatile parameter is deprecated. Use formState=none instead.



From the dox, that didn't appear to be an option, just VALUES and  
INTERATION. I think my main issue was the the working version stored  
the query parameters as part of the activation context, whereas the  
broken one wanted it to be submitted from the form. Since onPrepare is  
called before the form data was set, my array was null, so Tapestry  
decided to restore the values from the form. Not very intuitive, but a  
least I have a fix.


Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



Re: T5 loop sort

2009-11-27 Thread Joost Schouten (ml)
In your setupRender method of your page take the Set of beans add them 
in a List and sort acordingly. Pass the list as the source for the loop.


Cheers,
Joost

Like:

@SetupRender
private void setup() {
   SetMyBean mySet = ... whereverItComesFrom;
   ListMyBean myList = new ArrayListMyBean();
   myList.addAll(mySet);
   Collections.sort(myList, DATE_COMPERATOR);
}

/**
* This comperator will place the latest entry at the top
*/
   public final static ComparatorMyBean DATE_COMPERATOR = new 
ComparatorMyBean() {


   public int compare(MyBean bean1, MyBean bean2) {
   return bean1.getPostDate().compareTo(bean2.getPostDate());
   }
  
   };


blueboy6 wrote:

Hi everyone,

I have a question,

I have a set of beans that I'm parsing to loop component to generate divs
and populate them with data and other components that I'm using, now in this
beens i have date property.

What is best way to sort this set by date???

I was thinking to apply sorter from grid, but I'm not sure how...

Does anyone have idea what to do here? 


Thank you in advance :)
Bojan
  



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



Re: [T5] loop component - t:value local variable

2009-01-26 Thread Howard Lewis Ship
First off, just use the @Property annotation.  Field + @Property ...
no getters or setters.

Tapestry works in a type-safe manner, using real properties on the Java objects.

This is good: property access is validated during page construction,
not at runtime when a property expression is first evaluated.
Further, property access is converted into a PropertyConduit object; a
new class is created, and you get all the benefits of hotspot
optimizations and no reflection (including, no synchronization
issues).

The var: binding prefix gives a little bit of the behavior you want.

However, it's very hard to introduce a new, type-safe property into an
existing class in the way you suggest: that is, the Loop component
should create a new property on the containing Page class.

This is problematic for a number of lifecycle reasons (the page is
instantiated first, so it's a little late to create a new property by
the time the Loop component is instantiated an initialized).  This
could be addressed with considerable effort, and it would introduce
some ambiguities w.r.t. how subclasses of pages operate.

I don't find the need to define a property onerous; in fact, the
separation between template and code is very nice. The property gives
me the ability to know easily (using the debugger, for example) the
state of the things. Its documented, and defines a specific type. It's
easy: a property and an annotation. It's expressive.  Lastly, many
times you have an integration between template logic, encoded in the
template markup and use of components, and container logic. Having a
field in the container component is a very natural way to handle that.

I guess we all have a threshold for code magic.  Mine is pretty
high, I like all the magic and meta-programming that Tapestry does,
but sounds like your threshold is a bit higher than mine.



On Mon, Jan 26, 2009 at 1:00 PM, manuel aldana ald...@gmx.de wrote:
 hi,

 the Loop component is used basically used by (define a list t:source and
 bind a local iterable var t:value to access the values later):
 ...
 ol t:type=loop t:source=listItems t:value=listItem
   li${listItem.name}/li
 /ol
 ...

 What I find a bit clumsy is that you have to put this local-variable also to
 your page class:

 Page{
  ListItem listItems;
  Item listItem;
  ...
  //getter+setters
 }

 Why is tapestry not holding/creating the listItem local-var on the fly
 itself, instead of forcing to create a duplicated local variable (listItem
 is derived from listItems) inside the page class?

 --
 manuel aldana
 ald...@gmx.de
 software-engineering blog: http://www.aldana-online.de


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





-- 
Howard M. Lewis Ship

Creator Apache Tapestry and Apache HiveMind

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



Re: [T5] loop component - t:value local variable

2009-01-26 Thread manuel aldana

Hi Howard,

many thanks for explaining the trade-offs thorougly. From user-point of 
view it just feels a bit unnatural, that one needs to add a  property in 
the page class, which exists as a locally scoped and derived variable in 
the template.


After all tapestry5 looks extremely promising. Am digging deeper to code 
these days and am hoping to contribute some work in future :)


Howard Lewis Ship schrieb:

First off, just use the @Property annotation.  Field + @Property ...
no getters or setters.

Tapestry works in a type-safe manner, using real properties on the Java objects.

This is good: property access is validated during page construction,
not at runtime when a property expression is first evaluated.
Further, property access is converted into a PropertyConduit object; a
new class is created, and you get all the benefits of hotspot
optimizations and no reflection (including, no synchronization
issues).

The var: binding prefix gives a little bit of the behavior you want.

However, it's very hard to introduce a new, type-safe property into an
existing class in the way you suggest: that is, the Loop component
should create a new property on the containing Page class.

This is problematic for a number of lifecycle reasons (the page is
instantiated first, so it's a little late to create a new property by
the time the Loop component is instantiated an initialized).  This
could be addressed with considerable effort, and it would introduce
some ambiguities w.r.t. how subclasses of pages operate.

I don't find the need to define a property onerous; in fact, the
separation between template and code is very nice. The property gives
me the ability to know easily (using the debugger, for example) the
state of the things. Its documented, and defines a specific type. It's
easy: a property and an annotation. It's expressive.  Lastly, many
times you have an integration between template logic, encoded in the
template markup and use of components, and container logic. Having a
field in the container component is a very natural way to handle that.

I guess we all have a threshold for code magic.  Mine is pretty
high, I like all the magic and meta-programming that Tapestry does,
but sounds like your threshold is a bit higher than mine.



On Mon, Jan 26, 2009 at 1:00 PM, manuel aldana ald...@gmx.de wrote:
  

hi,

the Loop component is used basically used by (define a list t:source and
bind a local iterable var t:value to access the values later):
...
ol t:type=loop t:source=listItems t:value=listItem
  li${listItem.name}/li
/ol
...

What I find a bit clumsy is that you have to put this local-variable also to
your page class:

Page{
 ListItem listItems;
 Item listItem;
 ...
 //getter+setters
}

Why is tapestry not holding/creating the listItem local-var on the fly
itself, instead of forcing to create a duplicated local variable (listItem
is derived from listItems) inside the page class?

--
manuel aldana
ald...@gmx.de
software-engineering blog: http://www.aldana-online.de


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







  



--
manuel aldana
ald...@gmx.de
software-engineering blog: http://www.aldana-online.de


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



Re: T5: Loop with variables

2007-11-06 Thread Howard Lewis Ship
The x...y syntax is limited to constant values for x and y.  I think a
future release of Tapestry will increase the power of the built-in
expression language, but for the moment, there you go.

The x..y syntax is ultimately converted into an instance of
IntegerRange, so one way would be to create a getter method that
created and returned an instance of IntegerRange directly, then change
the source parameter of the Loop component to point to this property.

However, IntegerRange is an internal class, so be aware that it is
free to change at any time.

Or you could return a ListInteger or int[] of the desired values
from the method.

On Nov 6, 2007 9:02 AM, Tobias Wehrum [EMAIL PROTECTED] wrote:
 Hi all,

 I am currently working with the tutorial 1 at the Tapestry 5 homepage (
 http://tapestry.apache.org/tapestry5/tutorial1/hilo.html ).

 Now, one of the further tasks there is As we guess, we're identifying
 ranges of valid and invalid numbers. Can you only show valid guesses to
 the user?
 ...so, setting a loop (which counted before simply from 1 to 10) to
 count from one variable to another variable.

 My guess was that I just have to replace
 t:loop source=1..10 value=guess
 (which works) with
 t:loop source=${rangeStart}..${rangeEnd} value=guess

 Well, seems to be wrong. I get the following application exception:

 org.apache.tapestry.ioc.internal.util.TapestryException
 Failure writing parameter value of component Guess:loop: Coercion of
 1..10 to type int (via String -- Long, Long -- Integer) failed: For
 input string: 1..10
 (marked is the line shown above).

 So, he DOES replace the variables right, but that doesn't seem to be the
 same as 1..10 anymore.

 How can I solve this problem?

 Thanks in advance,
 Tobias

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





-- 
Howard M. Lewis Ship
Partner and Senior Architect at Feature50

Creator Apache Tapestry and Apache HiveMind

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Loop with variables

2007-11-06 Thread Tobias Wehrum

Hi Howard,

thanks for the fast answer, IntegerRange solved the problem. Maybe you 
could suggest this in your tutorial.


Keep up the great work,
Tobias

Howard Lewis Ship schrieb:

The x...y syntax is limited to constant values for x and y.  I think a
future release of Tapestry will increase the power of the built-in
expression language, but for the moment, there you go.

The x..y syntax is ultimately converted into an instance of
IntegerRange, so one way would be to create a getter method that
created and returned an instance of IntegerRange directly, then change
the source parameter of the Loop component to point to this property.

However, IntegerRange is an internal class, so be aware that it is
free to change at any time.

Or you could return a ListInteger or int[] of the desired values
from the method.

On Nov 6, 2007 9:02 AM, Tobias Wehrum [EMAIL PROTECTED] wrote:
  

Hi all,

I am currently working with the tutorial 1 at the Tapestry 5 homepage (
http://tapestry.apache.org/tapestry5/tutorial1/hilo.html ).

Now, one of the further tasks there is As we guess, we're identifying
ranges of valid and invalid numbers. Can you only show valid guesses to
the user?
...so, setting a loop (which counted before simply from 1 to 10) to
count from one variable to another variable.

My guess was that I just have to replace
t:loop source=1..10 value=guess
(which works) with
t:loop source=${rangeStart}..${rangeEnd} value=guess

Well, seems to be wrong. I get the following application exception:

org.apache.tapestry.ioc.internal.util.TapestryException
Failure writing parameter value of component Guess:loop: Coercion of
1..10 to type int (via String -- Long, Long -- Integer) failed: For
input string: 1..10
(marked is the line shown above).

So, he DOES replace the variables right, but that doesn't seem to be the
same as 1..10 anymore.

How can I solve this problem?

Thanks in advance,
Tobias

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







  



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Loop and ArrayList

2007-08-31 Thread Nick Westgate

The loop assigns each successive item to the value you give.
So for each iteration (item in the list) it will try to call:
setCurrentMember(Member member)

You need to provide such a member and set/get methods in Java:
private currentMember;

Then inside the loop you can refer to it using prop notation:
${currentMember.name}

Cheers,
Nick.


Angelo Chen wrote:

Hi,

I searched list for a while and can't find solution to this, so will just
post it here:

I have an ArrayList of a class and I need to access it from the loop, here
is the code in java:

 public class Member {
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public Member() {
this.name = member;
}
}

private ArrayList newMembers = new ArrayList();


 public ArrayList getNewMembers()
{
return newMembers;
}

  public Member getCurrentMember(int index)
{
return (Member)newMembers.get(index);

}

here is the template, it seems not right:
t:loop source=NewMembers value = CurrentMember index=i 
// how to display the name of each member here ?
/t:loop



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Loop and ArrayList

2007-08-31 Thread Angelo Chen

Hi Nick,

Thanks, got it working, your explanation clarifies points that I can't get
from the doc.


Nick Westgate wrote:
 
 The loop assigns each successive item to the value you give.
 So for each iteration (item in the list) it will try to call:
 setCurrentMember(Member member)
 
 You need to provide such a member and set/get methods in Java:
 private currentMember;
 
 Then inside the loop you can refer to it using prop notation:
 ${currentMember.name}
 
 Cheers,
 Nick.
 
 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-Loop-and-ArrayList-tf4358642.html#a12423049
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Loop

2007-06-21 Thread tamseo

Hi Anjana Gopinath

I'm having the same problem. Did you find the solution for it
Any one know how to fix it. It's very urgent for my project

Thanks

Tam


Anjana Gopinath-2 wrote:
 
 Howard,
 
 Thanks a lot for responding. I tried setting the volatile=true for  
 the Loop component, but i still have the same issue. When i try  
 printing the first element of the ArrayList on the onSuccess method,  
 it still shows the old value.
 
 Start.html
  
 --
 
 
 
 
 
 
 
 
 
 Start.java
 --
 public class Start
 {
   
   @Persist
   private ArrayListString values;
   
   
   private String value;
   
   public String getValue() {
   return value;
   }
 
   public void setValue(String value) {
   this.value = value;
   }
 
   @SetupRender
   public void fillValues()
   {
   System.out.println(fillvalues);
values = new ArrayListString();
values.add(test);
values.add(test1);
   this.setValues(values);
   
   }
 
   public ArrayListString getValues() {
   return values;
   }
 
   public void setValues(ArrayListString values) {
   this.values = values;
   }
   
   String onSuccess()
   {
   System.out.println(this.getValues().get(0));
   return null;
   }
   
 }
 
 
 
 Anjana Gopinath
 True North Technology
 
 
 
 
 On Apr 5, 2007, at 10:18 AM, Howard Lewis Ship wrote:
 
 This should work, but it looks like you simplified your example.

 The Loop component records into the form (as hidden fields) the values
 from its source parameter. When the form is submitted, it uses these
 values, and ignores it source parameter.

 In the short term, you should be able to get the Loop and Form combo
 to work by turning on the volatile parameter of the Loop.  In the long
 run, you should provide a PrimaryKeyEncoder to the Loop, to guide it
 in how to serialize the dynamic data into the Form.

 On 4/5/07, Anjana Gopinath [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to iterate over a list and display the values in a
 textfield. User can edit these values and i need to save these back
 to the list. I am able to display all the values, but the values are
 not getting updated when user saves them.

   
 
 

 
 
 

 Is this possible ? i searched in the mailing lists, but couldnt find
 any information.
 Thanks

 Anjana Gopinath
 True North Technology







 -- 
 Howard M. Lewis Ship
 TWD Consulting, Inc.
 Independent J2EE / Open-Source Java Consultant
 Creator and PMC Chair, Apache Tapestry
 Creator, Apache HiveMind

 Professional Tapestry training, mentoring, support
 and project work.  http://howardlewisship.com

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


 
 
 

-- 
View this message in context: 
http://www.nabble.com/T5-Loop-tf3531856.html#a11245636
Sent from the Tapestry - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: T5: Loop with @Component does not work

2007-04-13 Thread Kristian Marinkovic
hi all,

sorry for my previous post of course it works!!

my failure was that i had the Loop as public property 
without a getter method... if you do so you get an Error
message in your log you should read :)

g,
kris




Kristian Marinkovic [EMAIL PROTECTED] 
13.04.2007 12:09
Bitte antworten an
Tapestry users [EMAIL PROTECTED]


An
Tapestry users [EMAIL PROTECTED]
Kopie

Thema
T5: Loop with @Component does not work






hi, 

could someone help me to apply a T5 Loop with the
@Component annotation? The following code does 
not work all the necessary getter/setter methods are
in place (modification of T5 tutorial).

... or maybe the Loop is not meant to be used this way :)

g,
kris

span t:id=looping
a t:type=actionlink context=index${index}/a
/span

@Component(parameters={source=range,value=index})
public Loop looping;
 
private static ListString range = new ArrayListString();
static {
   range.add(1);
   range.add(2);
   range.add(3);
}


Re: T5: Loop with @Component does not work

2007-04-13 Thread Robert Zeigler
Right.  Annotations on properties will only be processed if the  
properties are private.
In fact, for components, unless you're going to access the component  
externally, you don't need a getter.




On Apr 13, 2007, at 4/135:50 AM , Kristian Marinkovic wrote:


hi all,

sorry for my previous post of course it works!!

my failure was that i had the Loop as public property
without a getter method... if you do so you get an Error
message in your log you should read :)

g,
kris




Kristian Marinkovic [EMAIL PROTECTED]
13.04.2007 12:09
Bitte antworten an
Tapestry users [EMAIL PROTECTED]


An
Tapestry users [EMAIL PROTECTED]
Kopie

Thema
T5: Loop with @Component does not work






hi,

could someone help me to apply a T5 Loop with the
@Component annotation? The following code does
not work all the necessary getter/setter methods are
in place (modification of T5 tutorial).

... or maybe the Loop is not meant to be used this way :)

g,
kris

span t:id=looping
a t:type=actionlink context=index${index}/a
/span

@Component(parameters={source=range,value=index})
public Loop looping;

private static ListString range = new ArrayListString();
static {
   range.add(1);
   range.add(2);
   range.add(3);
}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5: Loop with @Component does not work

2007-04-13 Thread Howard Lewis Ship

I often have to add @SuppressWarnings(unused) to the field which
defines the component as well.

On 4/13/07, Robert Zeigler [EMAIL PROTECTED] wrote:

Right.  Annotations on properties will only be processed if the
properties are private.
In fact, for components, unless you're going to access the component
externally, you don't need a getter.



On Apr 13, 2007, at 4/135:50 AM , Kristian Marinkovic wrote:

 hi all,

 sorry for my previous post of course it works!!

 my failure was that i had the Loop as public property
 without a getter method... if you do so you get an Error
 message in your log you should read :)

 g,
 kris




 Kristian Marinkovic [EMAIL PROTECTED]
 13.04.2007 12:09
 Bitte antworten an
 Tapestry users [EMAIL PROTECTED]


 An
 Tapestry users [EMAIL PROTECTED]
 Kopie

 Thema
 T5: Loop with @Component does not work






 hi,

 could someone help me to apply a T5 Loop with the
 @Component annotation? The following code does
 not work all the necessary getter/setter methods are
 in place (modification of T5 tutorial).

 ... or maybe the Loop is not meant to be used this way :)

 g,
 kris

 span t:id=looping
 a t:type=actionlink context=index${index}/a
 /span

 @Component(parameters={source=range,value=index})
 public Loop looping;

 private static ListString range = new ArrayListString();
 static {
range.add(1);
range.add(2);
range.add(3);
 }


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Loop

2007-04-05 Thread Howard Lewis Ship

This should work, but it looks like you simplified your example.

The Loop component records into the form (as hidden fields) the values
from its source parameter. When the form is submitted, it uses these
values, and ignores it source parameter.

In the short term, you should be able to get the Loop and Form combo
to work by turning on the volatile parameter of the Loop.  In the long
run, you should provide a PrimaryKeyEncoder to the Loop, to guide it
in how to serialize the dynamic data into the Form.

On 4/5/07, Anjana Gopinath [EMAIL PROTECTED] wrote:

Hi,

I am trying to iterate over a list and display the values in a
textfield. User can edit these values and i need to save these back
to the list. I am able to display all the values, but the values are
not getting updated when user saves them.

  span t:type=form
span t:type=Loop  source=values value=value 
span t:type=textfield  value=value/

/span
span t:type=submit/
/span

Is this possible ? i searched in the mailing lists, but couldnt find
any information.
Thanks

Anjana Gopinath
True North Technology








--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: T5 Loop

2007-04-05 Thread Anjana Gopinath

Howard,

Thanks a lot for responding. I tried setting the volatile=true for  
the Loop component, but i still have the same issue. When i try  
printing the first element of the ArrayList on the onSuccess method,  
it still shows the old value.


Start.html
 
--

span t:type=form
span t:type=Loop  source=values value=value volatile=true 
span t:type=textfield  value=value/

/span
span t:type=submit/



Start.java
--
public class Start
{

@Persist
private ArrayListString values;


private String value;

public String getValue() {
return value;
}

public void setValue(String value) {
this.value = value;
}

@SetupRender
public void fillValues()
{
System.out.println(fillvalues);
 values = new ArrayListString();
 values.add(test);
 values.add(test1);
this.setValues(values);

}

public ArrayListString getValues() {
return values;
}

public void setValues(ArrayListString values) {
this.values = values;
}

String onSuccess()
{
System.out.println(this.getValues().get(0));
return null;
}

}



Anjana Gopinath
True North Technology




On Apr 5, 2007, at 10:18 AM, Howard Lewis Ship wrote:


This should work, but it looks like you simplified your example.

The Loop component records into the form (as hidden fields) the values
from its source parameter. When the form is submitted, it uses these
values, and ignores it source parameter.

In the short term, you should be able to get the Loop and Form combo
to work by turning on the volatile parameter of the Loop.  In the long
run, you should provide a PrimaryKeyEncoder to the Loop, to guide it
in how to serialize the dynamic data into the Form.

On 4/5/07, Anjana Gopinath [EMAIL PROTECTED] wrote:

Hi,

I am trying to iterate over a list and display the values in a
textfield. User can edit these values and i need to save these back
to the list. I am able to display all the values, but the values are
not getting updated when user saves them.

  span t:type=form
span t:type=Loop  source=values value=value 
span t:type=textfield  value=value/

/span
span t:type=submit/
/span

Is this possible ? i searched in the mailing lists, but couldnt find
any information.
Thanks

Anjana Gopinath
True North Technology








--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






Re: T5: Loop component fails

2007-02-13 Thread Howard Lewis Ship

Looks like a coercion problem, I haven't built in coercions for the
various primitive array types. I'm not actually certain what failed.
I think we need a little more exception reporting inside TypeCoercer
to help identify what's going on.

On 2/13/07, Waldo Mendoza [EMAIL PROTECTED] wrote:

Hi there!

Congratulations to howard, tapestry 5 it´s really amazing and fun.

I have been trying the components that comes bundled with tapestry, and i got
and exception with a Loop test.

The template is:

html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd;
head
titleLoop Test/title
/head
body
p
span t:type=Loop source=numbers value=number
${number}
/span
/p
/body
/html

and the class:

public class Test
{

private int[] _numbers;

private int _number;

public int[] getNumbers()
{
return _numbers;
}

public int getNumber()
{
return _number;
}

public void setNumber(int number)
{
_number = number;
}

@SetupRender
void setupNumbers()
{
_numbers = new int[10];
for (int i = 0; i  _numbers.length; i++)
{
_numbers[i] = i;
}
}
}

The Exception is:

org.apache.tapestry.ioc.internal.util.TapestryException
Failure writing parameter value of component
com.tierconnect.licence.pages.Test:loop: For input string: [EMAIL PROTECTED]
location:
classpath:com/tierconnect/licence/pages/Test.html, line 7, column 55
java.lang.NumberFormatException
For input string: [EMAIL PROTECTED]
Stack trace:
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
java.lang.Long.parseLong(Long.java:403)
java.lang.Long.init(Long.java:671)
org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(TapestryIOCModule.java:301)
org.apache.tapestry.ioc.services.TapestryIOCModule$9.coerce(TapestryIOCModule.java:299)
org.apache.tapestry.ioc.internal.services.CompoundCoercion.coerce(CompoundCoercion.java:47)
org.apache.tapestry.ioc.internal.services.CompoundCoercion.coerce(CompoundCoercion.java:47)
org.apache.tapestry.ioc.internal.services.TypeCoercerImpl.coerce(TypeCoercerImpl.java:138)
$TypeCoercer_110bb52dac4.coerce($TypeCoercer_110bb52dac4.java)
org.apache.tapestry.internal.structure.InternalComponentResourcesImpl.writeParameter(InternalComponentResourcesImpl.java:218)
org.apache.tapestry.corelib.components.Loop._$update_parameter_value(Loop.java)
org.apache.tapestry.corelib.components.Loop.begin(Loop.java:275)
org.apache.tapestry.corelib.components.Loop.beginRender(Loop.java)
org.apache.tapestry.internal.structure.ComponentPageElementImpl$10$1.run(ComponentPageElementImpl.java:339)
org.apache.tapestry.internal.structure.ComponentPageElementImpl.invoke(ComponentPageElementImpl.java:936)
org.apache.tapestry.internal.structure.ComponentPageElementImpl.access$000(ComponentPageElementImpl.java:68)
org.apache.tapestry.internal.structure.ComponentPageElementImpl$10.render(ComponentPageElementImpl.java:343)
org.apache.tapestry.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:57)
org.apache.tapestry.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:40)
$PageMarkupRenderer_110bb52db45.renderPageMarkup($PageMarkupRenderer_110bb52db45.java)
$PageMarkupRenderer_110bb52db40.renderPageMarkup($PageMarkupRenderer_110bb52db40.java)
org.apache.tapestry.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:45)
$PageResponseRenderer_110bb52db41.renderPageResponse($PageResponseRenderer_110bb52db41.java)
$PageResponseRenderer_110bb52daec.renderPageResponse($PageResponseRenderer_110bb52daec.java)
org.apache.tapestry.internal.services.PageRenderDispatcher$1.renderPage(PageRenderDispatcher.java:78)
org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLinkHandlerImpl.java:54)
org.apache.tapestry.internal.services.PageLinkHandlerImpl.handle(PageLinkHandlerImpl.java:39)
$PageLinkHandler_110bb52db1d.handle($PageLinkHandler_110bb52db1d.java)
$PageLinkHandler_110bb52db19.handle($PageLinkHandler_110bb52db19.java)
org.apache.tapestry.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:88)
$Dispatcher_110bb52db1b.dispatch($Dispatcher_110bb52db1b.java)


Maybe i am doing something wrong, but the same code works with the _numbers
field as a array of Strings.

Thanks for your help, and again great job with Tapestry 5

Waldo

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--
Howard M. Lewis Ship
TWD Consulting, Inc.
Independent J2EE / Open-Source Java Consultant
Creator and PMC Chair, Apache Tapestry
Creator, Apache HiveMind

Professional Tapestry training, mentoring, support
and project work.  http://howardlewisship.com

-
To unsubscribe, e-mail: