Hi Kristian,

Thanks for the explanation, now it's getting a little clearer. let me
understand this and correct me if wrong:

Tapestry renders a page to the browser, onActivate was called at this time.
it generate another page or whatever you call it if a form is specified,
<form action="/myapp/edit.form_nam
e">, so this edit.form_name is the one that contains those onValidate,
onSuccess, onSubmit, etc, is it how T5 works behind the scene?  thanks.
A.C. 


kristian.marinkovic wrote:
> 
> hi angelo,
> 
> edit1 does not throw an exception because it is a string.
> Tapestry will automatically coerce the input and convert
> it to a string.
> 
> edit2 does not work without persist because after rendering
> the usr instance will be discarded and usr will reference null.
> on submit tapestry will try to call setName and  produce a NPE 
> because the usr is null.  knowing the type of a referenced bean
> or entity is not enough to be able to create one.
> 
> g,
> kris
> 
> 
> 
> 
> Angelo Chen <[EMAIL PROTECTED]> 
> 22.10.2007 10:14
> Bitte antworten an
> "Tapestry users" <[email protected]>
> 
> 
> An
> [email protected]
> Kopie
> 
> Thema
> T5: @Persist form field or not?
> 
> 
> 
> 
> 
> 
> 
> Hi,
> 
> I have two classes, Edit1 and Edit2,  name is the form field, when I 
> submit
> the form using Edit1, everything works, and when I tried Edit2, it 
> generates
> an exception:
> 
> java.lang.NullPointerException
> Stack trace
>                  • org.bfe.test.t5.pages.Edit.setName(Edit.java:52)
>                  •
> org.apache.tapestry.internal.bindings.PropBinding.set(PropBinding.java:67)
> 
> What's the difference here? if I @Persist usr, error goes away, then why I
> don't have @Persist name in the Edit1's case? thanks.
> 
> A.C.
> 
> 
> public class Edit1 {
>     private String name;
> 
>     public String getName() {
>         return name;
>     }
> 
>     public void setName(String name) {
>         this.name;
>     }
> 
> public class Edit2 {
>     private Usr usr;
> 
>     public String getName() {
>         return usr.getName();
>     }
> 
>     public void setName(String name) {
>         this.usr.setName(name);
>     }
> 
> 
> -- 
> View this message in context: 
> http://www.nabble.com/T5%3A-%40Persist-form-field-or-not--tf4669367.html#a13338569
> 
> Sent from the Tapestry - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/T5%3A-%40Persist-form-field-or-not--tf4669367.html#a13339601
Sent from the Tapestry - User mailing list archive at Nabble.com.


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

Reply via email to