Saturday, 31 August 2013

Accessing another object from logged in User

Accessing another object from logged in User

I am using Spring security with Grails. My User has username and it also
has a reference to another Domain object called Seller.
// Every user will usually be associated with a Seller
static belongsTo = [seller: Seller];
In GSPs, I can display the username of logged in User by doing:
<sec:ifLoggedIn>Hello <sec:username/> </sec:ifLoggedIn>
But I'd like to also display a property from the user's seller object. I try:
<sec:ifLoggedIn>Hello <sec:username/> <sec:seller.name/> </sec:ifLoggedIn>
But that gives:
Tag [seller.name] does not exist. No tag library found for namespace: sec
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
Any ideas?

No comments:

Post a Comment