I am a newbie in Java. I have created a 'dynamic java project'(java7) using eclipse luna and succesfully rendered a html page. What I want is to create a dynamic map from postgis-postgresql to show & query different layers. For that I installed geoserver but don't know how to configure.
GeoServer comes with copious documentation, I would start with the Getting Started section which walks you through adding a shapefile and a postgis table.
OpenLayers also provides some great documentation and many examples.