hey guys am trying to send a value for user if he is logged in and in not i execute an if statement in a home page scala template
User loggeduser = User.find.query().where().eq("token",
session("connected")).findOne();
return ok(main.render(loggeduser));
in scala home page template am trying something like this
@(user: User)
@if(user.fname==null){ i even tried @if(user.isEmpty)
and tried to keep fname outside yet the same error for a NULL POINTER EXEPTION then show some login form links
}else(user!=null){
<a class="dropdown-toggle" data-toggle="dropdown" id="signHover">@user.fname</a>
}
please if have any suggestion guide me throw the process
reference :https://www.playframework.com/documentation/2.6.x/JavaTemplates
Assuming User is null if there's no user, shouldn't you have
@(user: User)
@if(user!=null){
// do stuff
} else {
// do stuff for no user
}