Re: PersistenceConstants.FLASH cann't persist ListString langs

2013-02-22 Thread zhouyc
if i don't want to store the List in the session for a long time, is there
any advice to solve this problem?



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/PersistenceConstants-FLASH-cann-t-persist-List-String-langs-tp5719462p5720163.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



Re: PersistenceConstants.FLASH cann't persist ListString langs

2013-02-22 Thread mvchris
bit of a hack but can you put the list to a single string delimited by
control chars or caret ^
prior to form submission

then on rendering of 2nd page convert back from single string to list

chris



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/PersistenceConstants-FLASH-cann-t-persist-List-String-langs-tp5719462p5720167.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



Re: PersistenceConstants.FLASH cann't persist ListString langs

2013-02-22 Thread Ivan Khalopik
As far as I understood flash strategy is needed to store values between
form submission and render requests.
Your flow:
1. onActivate() create values and store them in session
2. onSubmit() retrieve values and remove them from session = add value to
detached collection
3. onActivate() retrieve values = they are null = create new and store
them in session

So, the right choice depends on what you need.
1. If you want to have values be available from render to form submission
request - always create values during render phase, e.g.:

onActivate() {
  langs = new ArrayListString();
}

2. If you need to have values be available from form submission to render
request - always create values during submit phase, e.g.:

onSubmit() {
  langs = new ArrayListString();
}

NOTE: this is the best choice as session is empty most of the time. Values
are created on form submission and immedeately goes to render phase where
this values are removed from the session.

3. If you need both variants - use SESSION strategy.

On Fri, Feb 22, 2013 at 1:57 PM, mvchris ch...@mrvoip.com.au wrote:

 bit of a hack but can you put the list to a single string delimited by
 control chars or caret ^
 prior to form submission

 then on rendering of 2nd page convert back from single string to list

 chris



 --
 View this message in context:
 http://tapestry.1045711.n5.nabble.com/PersistenceConstants-FLASH-cann-t-persist-List-String-langs-tp5719462p5720167.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




-- 
BR
Ivan


PersistenceConstants.FLASH cann't persist ListString langs

2013-01-24 Thread zhouyc
please help me to solve the problem?
after submitting and page redisplayed, username can be saved, but langs lost
values added by submit method.

@Property
@Persist(PersistenceConstants.FLASH)
private String username;

@Property
@Persist(PersistenceConstants.FLASH)
private ListString langs;

void onActivate() {
if (langs == null) {
   langs = new ArrayListString();
}
}

void onSubmit() {
 langs.add(en);
}



--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/PersistenceConstants-FLASH-cann-t-persist-List-String-langs-tp5719462.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