Two Israelis have been killed and three injured in separate attacks in Jerusalem by Palestinians who were then shot dead by police.