For this you need to update your Project Facets setting.
Project (right click) -> Properties -> Project Facets from left navigation.
If it is not open...click on the link, Check the Dynamic Web Module Check Box and select the respective version (Probably 2.4). Click on Apply Button and then Click on OK.