Collectively speaking as a single war, WW2 was the single definitive event that demonstrated the concept that the idea of naval surface vessels fighting in one dimension had become nearly obsolete. A hint of this obsolescense came before the war, actually. In the early 1930s, American Admiral Ernest King ordered an exercise aerial attack against Pearl Harbor. The attack was a "success"; had the aircraft been hostile and had real bombs been used instead of sacks of flour, warships would had been sunk helplessly. This demonstrated that a traditional naval port at that age, even one as major as Pearl Harbor, was not prepared to deal with threats from up above. The warning fell on deaf ears. The Americans were not the only ones oblivious to the upcoming paradigm shift; the reluctance to accept the change was common across most nations. Even Winston Churchill, champion of Britain's anti-aircraft defense that played a major role in the upcoming Battle of Britain, did not realize the potentials of aerial warfare. "[E]ven a single well-armed [naval] vessel will hold its own against aircraft", he exclaimed. Few saw the destructive potentials of a well-coordinated wave of small aircraft.
Both the Americans and the British paid dearly for their inability to see the coming change. The surprise attack at Pearl Harbor saw 21 warships disabled or sunk while in port. Off Kuantan, Malaya, British warships Prince of Wales and Repulse were caught without air cover, and both were sunk with a loss of 800 men. The Italians were baptized by fire, too, as 21 Swordfish aircraft sank a battleship and damaged others. One by one, shocking realizations were delivered: the future of naval power was to be harnessed not from the surface, but from up above.
Of course, airpower was not only changing naval warfare. Though going slightly off-topic, on the ground it was much the same. French General Maurice Gamelin, traditionally-minded, commented that "[t]here is no such thing as the aerial battle". The French Army in turn crumbled as they were faced with bombardment from the skies, instead of from artillery as they expected, when Nazi Germany invaded in 1940. Airpower was changing ground warfare just the same.
But did the surface vessels really become useless after that point? The answer is no, though they were gradually being transferred into different roles. Anti-aircraft screening, for example, became an important role for surface vessels. During the attack on Truk, effective anti-aircraft screen set up by American surface vessels prevented the Japanese aircraft from effectively disrupting carrier operations. Naval gun support for ground units also remained a role for the big caliber guns of surface vessels of various sizes, as seen in every Pacific landing operation conducted.
I'll provide some links below from my website that provides more details on the events described above:
WW2DB: Attack on Taranto
WW2DB: Invasion of Malaya and Singapore
WW2DB: Attack on Pearl Harbor
WW2DB: Ernest King
WW2DB: Winston Churchill
I hope this will spark a bit of conversation here as the rise of air power in naval doctrine was a rather interesting one.