deployment - No web.xml in Eclipse + Glassfish v3? -


i created simple "hello world" servlet in eclipse (helios) + glassfish v3. using glassfish's plugin eclipse seems there no web.xml sun-web.xml in web-inf/ folder. first time glassfish bit surprised @ absence of web.xml - here of problems:

  1. where check url-mappings servlet? on creating new servlet in eclipse asks me url-mapping i'm unable find anywhere in .xml file can tweak settings.
  2. if there isn't web.xml, creating scratch quite error prone. suggest? google sample , play around? shouldn't 1 auto-created?
  3. has encountered this? tried looking difference between web.xml , sun-web.xml results weren't @ enlightening. wouldn't want learn xml configuration purposes , glassfish specific.

we have configure servlet contexts, mappings etc during development/testing sheer absence of web.xml has me stumped.

eclipse allows not create web.xml file when create dynamic web project java ee 6, since java ee 6 spec (in general) , servlet 3.0 spec (in particular) attempt de-emphasize deployment descriptors.

you can use annotation provide data had been included in web.xml file. javadoc servlet 3.0 annotations pretty obtuse. should read through servlet 3.0 spec jcp.org site bit more explanatory text.

to change url-mapping servlet 3.0 servlet, first place in source code servlet. (and change) value of urlpatterns element.

if trying create web app based on servlet 3.0, try avoid creating web.xml file.

the sun-web.xml/glassfish-web.xml file used 'finish' description of war file deployment glassfish container.

one other note annotations webservlet... not integrate annotated class class hierarchy, correct use of @webservlet like

@webservlet(     name = "myservlet",      urlpatterns = {"/path_to_servlet"} ) public class myservlet extends httpservlet {} 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -