BadMoonKiller
22 Mar 2009, 8:42 AM
Hello Community
I have some problems with the XTemplate. My application works with hibernate.
On the database I have a column firstName, lastName and studyGroup. studyGroup is a foreignkey to another table. Sometimes its value is NULL.
If studyGroup is NULL, the second <p>-element shouldn't be post.
Now, if I run this code i always get a javascript exception, that studyGroup is undefinied, even if I check that in the code below... How can i do that right?
Here ist my template code:
private native String getTemplate() /*-{
return ['<tpl for=".">','<p>{firstName} {lastName}</p>{street}</p>','<tpl if="studyGroup != null">','<tpl for="studyGroup">','<p>{name}</p>','</tpl>','</tpl>','</tpl>'].join("");
}-*/;
I have some problems with the XTemplate. My application works with hibernate.
On the database I have a column firstName, lastName and studyGroup. studyGroup is a foreignkey to another table. Sometimes its value is NULL.
If studyGroup is NULL, the second <p>-element shouldn't be post.
Now, if I run this code i always get a javascript exception, that studyGroup is undefinied, even if I check that in the code below... How can i do that right?
Here ist my template code:
private native String getTemplate() /*-{
return ['<tpl for=".">','<p>{firstName} {lastName}</p>{street}</p>','<tpl if="studyGroup != null">','<tpl for="studyGroup">','<p>{name}</p>','</tpl>','</tpl>','</tpl>'].join("");
}-*/;