I know it's a very basic question but I've been searching for an answer for over 4 hours and I can't get it to work.
I have GeoServer running locally and I'm trying to open a layer in my browser through OpenLayers 2.
This is the code I have:
<html>
<head>
<title>OpenLayers Example</title>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
</head>
<body>
<div style="width:100%; height:100%" id="map"></div>
<script defer="defer" type="text/javascript">
var map = new OpenLayers.Map('map');
var wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://localhost:8080/geoserver/wms", {layers: 'nurc:nyc_buildings'} );
map.addLayer(wms);
map.zoomToMaxExtent();
</script>
</body>
</html>
I copied everything exactly like the example in the OpenLayers website, only changed the URL for the layer and the layer workspace/name.
I tried changing the url to "localhost:8080/geoserver/nurc/wms" and every other possible combination, and I can't get it to work. All I can see is the "+" and "-" for zooming in and out of the layer, but the layer is blank, and sometimes it shows only pink tiles.
Firebug does not show any errors.
Any suggestions please?