I'm not sure if it's the right way but when I got Peter I set up his litter tray in his cage with some hay in it and kept him confined to the cage for a few days (let him out for a bit of exercise but he was mainly in the cage). Any poos that were done outside the tray I swept up and put in there, when everything was being done in the tray I let him out and he knew to go back to the tray. It was very easy and he has never (touch wood) done a wee anywhere other than in his cage (although the odd poo does escape-lol)!!