Java Reference
In-Depth Information
We can also add initialization parameters for our servlets, these parameters can be
read by our servlet by invoking the getInitParameter() method defined in the
javax.servlet.GenericServlet class. All servlets in a web application extend
javax.servlet.http.HttpServlet , which in turn extends javax.servlet.
GenericServlet , therefore this method is available to all of our servlets through
inheritance. This method takes the initialization parameter as a String object and
returns its value as a String . In our particular servlet we don't need initialization
parameters therefore we don't need to enter any in the NetBeans servlet wizard.
Clicking on the Finish button creates our servlet. It used to be the case that every Java
web application had to contain a web.xml deployment descriptor. As of Java EE 6,
this deployment descriptor is optional in many cases, as the configuration information
that used to be specified in web.xml can now be specified through the @WebServlet
annotation, NetBeans uses this annotation by default when generating servlets.
 
Search WWH ::




Custom Search