You don't say what line your getting your npe but I'm guessing it's this: if(user.getUserType().equalsIgnoreCase("Admin")
if .getUserType() is null as you imply it can be then calling .equalsIgnorecase() is going to result in an npe. On Fri, 2011-04-08 at 04:59 -0700, robnangle wrote: > I am working on my index page and I am setting the side bars based on three > types of people that will be on it: > 1) A normal user who userType is null, as they will never have the option to > view or change it > 2)An admin user who userType is set to a string "Admin" > 3) Any viewer who will be able to see basic information.. > > However i am getting a line not available error, saying there is a null > pointer on the object? > > Code: > > public boolean adminUser() { > /*if(!user.getUserType().equalsIgnoreCase("Admin")) { > adminUser = false; > } > else*/ if(user.getUserType().equalsIgnoreCase("Admin")) > { > adminUser = true; > setAdminUser(true); > } > return adminUser; > } > > public boolean getAdminUser() { > return adminUser; > } > > public void setAdminUser(boolean adminUser) { > this.adminUser = adminUser; > } > > public Object onSubmitFromLogin() throws Exception { > createDb(); > if (validUser()) { > adminUser(); > return index; > } > else { > login.recordError("Invalid Login"); > return loginPage; > } > } > > In the tml i just use the statements to determine between the different > types.. > > Any ideas as how to get around this? > > > -- > View this message in context: > http://tapestry.1045711.n5.nabble.com/Object-creator-set-to-null-tp4290653p4290653.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org