Once had some snooty old prof. type in Oxford go to back-hand clout one of our pups for jumping up at his knee on port meadow...
Its quite amazing the look of confusion you can get out of someone when you bark all out condemnation at them, at the top of your lungs... with the right choice of words you can leave them wondering for some time wether you were reprimanding them or your your dog.
Of course this method is only suitable for training the type of idiot who is about to clobber your best friend. This is not a good dog training tip
I wouldn't try it if I thought I might confuse the dog, my pup was reinforced with the notion that the alpha male in our pack was acting in his defense.
I agree with Tina's method though for getting your pup to pay little regard to strangers, it works very well, and doesn't take long for the pup to want only your attention and not that of every passer by. I also discourage strangers from offering my dogs tit-bits, treats or fuss. It's not going to help if the person your pup runs over to or jumps up at praises them for it.