> > if I have an attribute, I should use a setter to assign it? like this: > Hmm... looking at javassist, it looks like there is the ability to modify field level access within a method. Perhaps, if changing to the setter worked then this should be filed as a defect, if it isn't already.
Josh On 10/11/07, Angelo Chen <[EMAIL PROTECTED]> wrote: > > > Hi, > > You are correct. this does bring up a question: > > if I have an attribute, I should use a setter to assign it? like this: > > private String id; > > void onActivate() { > > id = "myid"; // wrong > setId("myid"); // correct ? > > if (id == "myid"); // wrong > if (getId() == "myid"); // correct? > > } > > ? > > > > > Josh Canfield-2 wrote: > > > >> > >> even i set uid to null, it is still not null next time when the page is > >> activated, why? what's the correct way of setting a persisted variable > >> null? > >> > > > > I would guess that the right way to do it would be to use the setter > > method > > for the attribute. I haven't looked, but I would guess that Tapestry is > > catching assignments to that attribute via the setter, and when you set > it > > directly you are bypassing that code. > > > > Josh > > > > > > On 10/11/07, Angelo Chen <[EMAIL PROTECTED]> wrote: > >> > >> > >> Hi, > >> > >> I have this class: > >> public class Confirmation { > >> > >> @Persist > >> private String uid; > >> > >> public Class onActivate(String id) { > >> if (uid == null) { > >> uid = id; > >> } > >> return null; > >> } > >> > >> public String onPassivate() { return uid;} > >> > >> String onActionFromAutoLogin() { > >> uid = null; > >> return "MyPage"; > >> } > >> } > >> > >> even i set uid to null, it is still not null next time when the page is > >> activated, why? what's the correct way of setting a persisted variable > >> null? > >> Thanks. > >> A.C. > >> > >> -- > >> View this message in context: > >> > http://www.nabble.com/T5%3A-How-to-set-persisted-variable-to-null-tf4605726.html#a13151324 > >> Sent from the Tapestry - User mailing list archive at Nabble.com. > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [EMAIL PROTECTED] > >> For additional commands, e-mail: [EMAIL PROTECTED] > >> > >> > > > > > > -- > > -- > > TheDailyTube.com. Sign up and get the best new videos on the internet > > delivered fresh to your inbox. > > > > > > -- > View this message in context: > http://www.nabble.com/T5%3A-How-to-set-persisted-variable-to-null-tf4605726.html#a13166676 > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox.