package com.corejsf;

import java.io.Serializable;

import javax.faces.bean.ManagedBean; 
   // lub import javax.inject.Named;
import javax.faces.bean.SessionScoped; 
   // lub import javax.enterprise.context.SessionScoped;

@SessionScoped
@ManagedBean(name="user") // lub @Named("user")
public class UserBean implements Serializable {
   private String name;
   private String password;

   public String getName() { return name; }
   public void setName(String newValue) { name = newValue; }

   // W tym miejscu celowo powodujemy wyjątek NullPointerException:
   public String getPassword() { return password.substring(0); }
   public void setPassword(String newValue) { password = newValue; }
}