added anew function getViewVar
removed the sessionwrite in the controller