Dont worry - My son did that all the time - he used to do it outside on the concrete if you didn't walk in the direction he wanted to go! He is 6 now and still the tantrum king! He is very bright - he reads at least at age 8 level, and very highly strung. We have tried everything to stop the tantrums, but nothing seems to work although they are getting less frequent. However, he did stop the banging his head of things when we just ignored it and he realised that it hurt to much to be worth the effort. He never came to any harm. His older brother had about 2 tantrums which we ignored and he never bothered again, so it is not necessarily the way that we have dealt with them, it is part of his personality. He used to try to engineer a situation so he could have a tantrum - I think he actually enjoys it!
It is just part of being a child - strategies worth trying are:
a.) ignore them
b.) try to anticipate them coming and get him onto something else - "Oh look at that out of the window" etc.
c) watch for what his trigger points are and try to avoid those situations
d.) offer a limited choice of things so tha he feels that he has some control - "do you want the red or blue hat" that will maybe stop him from having a tantrum because you are going outside if you get my drift.
He is just being a toddler and trying out your limits - try to stay calm and not to fuss - if he thinks he is getting attention,he will keep doing it.