answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: Can you deploy servlet as web service?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Importance of deployment descriptor in servlet?

The deployment descriptor is an xml file that contains the basic and most important information that is required to deploy a web application (Servlet) Without this, the web server would not know, which requests to entertain/consider as requests to access this servlet.


Where do you deploy the servlet files?

The Servlet file and all other components of the web/j2ee project get deployed onto a web server (Websphere, Weblogic, Tomcat etc) They are packaged into an Enterprise Archive file (EAR) and deployed on the server


What is JAVA Servlet Development Kit?

Java Servlet Development Kit is an integrated development kit used to build, test, and deploy Java Servlet applications. JSDK allows most standard Web server such as Netscape servers, IIS, Apache and others to load servlets . JSDK is a suite of software for easing the development of Java servlets.


Why servlet has no constructor?

Because it is not a regular Java Class that is executed by a JVM. It is a special Java class that is executed by the Web Container which initializes and loads the servlet and the service methods get executed everytime it receives a request.


How do you run servlet in tomcat?

You Run a Servlet by deploying it on the server, which in this case is tomcat. We need to deploy the servlet in the Web Applications context. When we talk of a Web application's context, we are referring to that Web application's root directory or path within a particular server. A special directory exists within the application hierarchy named WEB-INF. This directory contains all things related to the application that aren't in the document root of the application. It is this WEB-INF directory that is the Web application's root directory, also referred to as the context. The most important file here is web.xml, the name of the WebApp deployment descriptor. Let us take a look at the various contents (files & folders) that will be present inside this WEB-INF directory: 1. /WEB-INF/web.xml - This is the Deployment Descriptor file 2. /WEB-INF/classes/ - This is the directory where all your java class files will be placed 3. /WEB-INF/lib/ - This is the folder where all your JAR files go. my tomcat is installed in c:\dev\java\Jakarta-tomcat-4.0.1. This is my TOMCAT_HOME. Remember that, this path that is referred by TOMCAT_HOME might vary from PC to PC depending on the installation preferences of the user. To Deploy the Servlet, you need to place the .class file corresponding to your servlet in the /WEB-INF/classes/ folder


How do you compile servlet in java using tomcat?

Tomcat is a server. It is used to deploy and run Servlets and not compile them. A Servlet is a java file and has to be compiled just like any other Java Class.


What is servlet mapping?

A Servlet Mapping is a directive in the web.xml that tells the Servlet Container which class to use when a particular Servlet is called. A Servlet is a class within your Java Web Application. Let's say you have a servlet called MyServlet in the com.example.servlet package. You would need to have a Servlet Mapping pointing the path "/MyServlet" to the "com.example.servlet.MyServlet" class. Without the servlet mapping, you would not be able to invoke your servlet because the Servlet container would not know where it is. JSPs are different - they do not need mappings like this. JSPs exist within the WebRoot of the application, so they are always available. Servlets exist in the WEB-INF\Classes directory once your application is deployed.


How does Apache httpd work?

Tomcat is a servlet container, and the following is how a servlet container works The init, service, and destroy methods are the servlet's lifecycle methods. The init method is called once by the servlet container after the servlet class has been instantiated to indicate to the servlet that it being placed into service. The init method must complete successfully before the servlet can receive any requests. A servlet programmer can override this method to write initialization code that needs to run only once, such as loading a database driver, initializing values, and so on. In other cases, this method is normally left blank. The service method is then called by the servlet container to allow the servlet to respond to a request. The servlet container passes a javax.servlet.ServletRequest object and a javax.servlet.ServletResponse object. The ServletRequest object contains the client's HTTP request information and the ServletResponse encapsulates the servlet's response. These two objects enable you to write custom code that determines how the servlet services the client request. The servlet container calls the destroy method before removing a servlet instance from service. This normally happens when the servlet container is shut down or when the servlet container needs some free memory. This method is called only after all threads within the servlet's service method have exited or after a timeout period has passed. After the servlet container calls destroy, it will not call the service method again on this servlet. The destroy method gives the servlet an opportunity to clean up any resources that are being held (for example, memory, file handles, and threads) and make sure that any persistent state is synchronized with the servlet's current state in memory. For Better Picture, Visit below article full of images to clear the concept : http://shivasoft.in/blog/java/servlet/how-container-handles-the-servlet-request/


What class is a new servlet usually inherited?

The servlet class created in web applications usually extend the javax.servlet.HttpServlet class. The HttpServlet extends the javax.servlet.GenericServlet. These classes contain the basic features that are required to run a web application.


What is the use of Servlet in java?

Java Servlet is used for Server Side programming for developing Web Applications. It easily employs Database Connectivity. We can also use JSP however it cannot replace a Java Servlet.


Difference between HTTP servlet and Generic servlet?

The difference is that a GenericServlet has no defined protocol (it is "generic"), while HttpServler uses the HTTP protocol. HttpServlet is a subclass of GenericServlet with the purpose of creating a servlet for a web site.


What is generic servlet class?

GenericServlet defines a generic, protocol-independent servlet whereas HttpServlet Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site that uses the Http Protocol.