Hi, I would recommend reading advices on this webpage:
http://www.webtrail.com/petbehavior/case.html.
As Mirka says, the best thing to do is to redirect attention and make dog do something what you can reward. It is not good to punish the dog for being aggresive, as it will connect the punishment with seeing other dogs.
I am happy to have a fairly submissive 9 months old bitch (we will see if it holds), but I always try to make her greet dogs which we meet by greeting them myself happily from distance (although the owners might think I am crazy) and catch her attention if she is barked at by an aggresive dog behind a fence.