answersLogoWhite

0

Search results

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.

1 answer


Java Applet is an application designed to transmit on internet to execute on java compatible browsers. Java Servlet is a server side program used to provide services to clients.

1 answer


Networking is a basic action. A servlet in Java is a single part of networking, a single task.

1 answer


Yes you can but it is not required. A Servlet is nothing but another .java file and all rules that are applicable to standard Java classes are applicable to them.

Note: Even if you write a constructor in a servlet, it will not get executed.

1 answer


Still have questions?
magnify glass
imp

No. Javascript code can be present inside a JSP but not inside a servlet. A Servlet is a pure java class.

1 answer


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.

1 answer


You cannot. HTML is a static file and it cannot interact with a Java Servlet. A Servlet can always redirect to a HTML page but the other way round cannot happen.

1 answer


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.

1 answer


Perl, php and Java are all examples of programming languages.

1 answer


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.

1 answer


Servlet Chaining means the output of one servlet act as a input to another servlet. Servlet Aliasing allows us to invoke more than one servlet in sequence when the URL is opened with a common servlet alias. The output from first Servlet is sent as input to other Servlet and so on. The Output from the last Servlet is sent back to the browser. The entire process is called Servlet Chaining.

1 answer


(This is a bit subjective). Servlets can integrate easily into an existing Java application or applet, simply because a servlet is just another class, which is a fundamental concept taught to almost every java programmer.

1 answer


No. It must be a Web Server that has Java Installed in it

1 answer


You can do this if:

  • The Java Script code is present inside a JSP page
  • The JSP page is part of a J2EE application

By submitting the HTML Form the control would go back to the Servlet.

1 answer


Core java comes with J2SE specification

Web and distributed enterprise applications in java comes with J2EE specification

1 answer


Applet:

It is run on browser, i mean client side.

Servlet:

It is run on server, i mean server side.

1 answer


Servlet is a Server side component, a servlet is a small pluggable extension to the server and servlets are used to extend the functionality of the java enabled server.

1 answer


A Servlet is a Java programming language class used to extend the capabilities of a server. Although servlets can respond to any types of requests, they are commonly used to extend the applications hosted by web servers

A Servlet is a Java-based server-side web technology.

The javax.servlet package contains a number of classes and interfaces that describe and define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container.

1 answer


A java servlet is the heart of a Java Enterprise web application. It contains most of the business logic that the web application needs. The initial web application technologies did not have capabilities to support dynamic contents in a secure and efficient way. Java Servlets were created to address this drawback. Servlets are used in many types of Java EE applications using technologies like Struts, MVC etc.

1 answer


request.getAttribute() is used on the Server side Java code to get values submitted from the form onto the Servlet or other java classes

request.getParameter() is used on the JSP page to get values sent by the servlet and display it in the jsp page

1 answer


The Java Servlet is like every other Java class. You can compile it using the javac command or if you are using a Integrated Development Environment (IDE) like Eclipse, it will compile the class for you.

One main difference w.r.t Servlets is the fact that, they get deployed into EAR files (Enterprise Archive Files) and not JAR files (Java Archive Files) like normal java apps.

2 answers


Servlet is more faster than JSP, but JSP is more convenient than Servlet and JSP is clearly superior, shorter, simple and easier to use. JSP can be perceived as Java in HTML code. JSP require no explicit compilation as like servlets and can keep in the web application server as HTML file. The web application server in turn compile the java code in JSP and load it in its library for future execution. Servlet can be perceived as HTML in Java code. The servlet is the class file, which would be loaded in the web application server as a program. The program output will be directed to the outstream object which in turn direct to the client as HTML elements.

1 answer


Apache Tomcat is a servlet container developed by the Apache Software Foundation (ASF). Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a "pure Java" HTTP web server environment for Java code to run. Stephen Williamson, Server Engineer, http://www.HostMySite.com?utm_source=bb

1 answer



Applet to servlet communication refers to the interaction between a Java applet running in a client’s web browser and a Java servlet running on a server. This communication typically occurs over HTTP, where the applet sends requests to the servlet to retrieve or send data, often using URL connections. The servlet processes these requests and returns responses, which the applet can then use to update its UI or perform further actions. This interaction enables dynamic web applications by allowing client-side applets to leverage server-side resources.

1 answer


A .do file is a Java servlet and should play in the Safari web browser on a Mac. Make sure you have Java enabled in the Security settings of Safari's preferences.

1 answer


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.

1 answer


A Servlet is a Java class that is the heart & brain of web applications.

Web applications are applications that are viewed via the browser.

Let me explain with an example.

You are now in wikianswers website. You have a bunch of links on the left side of this page. When you click on any of them you can see that the page goes somewhere and then reloads with fresh content.

Once you click the system goes to the servlet. Based on the link you clicked the servlet would decide which page to open and then it will fetch the necessary information that would be needed for the page.

1 answer


Java is a platform independent language and is widely used. In java JSP-SERVLET architecture creates over head of response and request object. So to simplify it ,a framework called struts was introduced.

Like .net struts is also a framework which is advance version of jsp-servlet archite cture . Struts framework provides functionalities like to include struts tags, jquery.

3 answers


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.

2 answers


There is no specific/separate servlet development kit. Servlets can be developed and compiled using the standard JDK and JRE.

The only difference being the fact that - to run them you need a web server

1 answer


Servlets serve as the central point of control of a J2EE application. It contains all the processing and control logic of the application.

1 answer


A servlet is a Java program that runs on a web server and extends its capabilities to handle requests and responses. When a client sends a request, the server routes it to the appropriate servlet, which processes the request using methods like doGet() or doPost(). The servlet then generates a response, often in the form of HTML or JSON, and sends it back to the client. This process allows for dynamic web content generation based on user interactions.

1 answer


J2SE stands for Java 2 Standard Edition and I dont think Servlets are a part of it. Servlets are only part of the Java 2 Enterprise Edition.

1 answer


JAVA beans and coffee beans are two very different things . JAVA beans are used to generate getters and setters. while coffee beans are use to make coffee.

2 answers


JSP and servlets are used in when you are building a website that provides a server sided service, for example connecting to a database is a service. == == JSP/Servlets are java code that perform the backend operations for web pages. Such servlets run in a java container, such as JBoss or Tomcat. Where you would use these would be in a web-based environment where you wanted to run the backend on Java, as opposed to PHP, Perl, etc. As an example, eBay is run by JSP/Servlet technology. However, JSP/Servlet technology is much more complicated than scripting languages, but well worth learning.

1 answer


I think you mean: why isn't there a function required in a servlet like the following? public static void main(String[] args) { } Because the main() method is what the Java VM 'boots up' into...it's the first thing the JVM executes. A servlet, however, is running inside a servlet container (e.g., Tomcat), which is running inside a JVM. *That* JVM gets started with a main() method, but unless you intend to run your servlet from the commandline, there's no explicit need for a main() method.

1 answer


A JavaBean is nothing but a regular Java Class and hence it can be instantiated using the new keyword and invoking the bean constructor

1 answer


1) The servlet execute on the address space of the web server .It is not necessary to create a separate process to handle each client request

2) servlet are platform independent because they are written in java

3) The java security manager on the server enforces a set of restriction to protect the resource on a server machine

4) All the java libraries class are available to a servlet.It can communicate with applets,database,or other software via the sockets.

1 answer


Applet is a part of Core JAVA and Servlet of Advance Java. Applet is client side program and Servlet is Server side. When Applet runs it take the resources of client whereas Servlet is processed at server. An Applet's class, jar files can be accessed and downloadable by client but not so in case of servlet. Applets can run under any web browser their execution is dependent on Client as they require JRE Whereas Servlets do not require any thing specific at client side, as they require java enabled web/application Server. Dilpreet Singh (SCJP,OCA 9i) www.geocities.com/heartsingh
The main difference is that a servlet is a server side component while applet is a client side component, moreover, a servlet doesn't have GUI while applet have GUI. A servlet runs inside a server and results are sent to client, so it consumes less network bandwidth, and also secure, while applet runs on client side in a browser, so entire code for applet is 1st sent to client and then it is executed on the client machine itself, so it also consumes more network bandwidth.

1 answer


servlet is a small program which run on serverside,and it can not be downloaded at client side.

java servlets dynamically extends the functionalities of a web server.

main use is:

session tracking: no of users (unique) visited u'r website.

in order to use cookies..

1 answer


Http servlet and Generic servlet

1 answer


Servlets are modules of Java code that run in a server application (hence the name "Servlets", similar to "Applets" on the client side) to answer client requests. Servlets are not tied to a specific client-server protocol but they are most commonly used with HTTP and the word "Servlet" is often used in the meaning of "HTTP Servlet".

Servlets make use of the Java standard extension classes in the packages javax.servlet (the basic Servlet framework) and javax.servlet.http (extensions of the Servlet framework for Servlets that answer HTTP requests). Since Servlets are written in the highly portable Java language and follow a standard framework, they provide a means to create sophisticated server extensions in a server and operating system independent way.

Advantages of Using Servlets

a. They are faster than CGI scripts because each CGI script produces an entirely new process that takes a lot of time to execute, whereas a servlet creates only a new thread.

b. Servlet API is standard and available easily on the internet (like JSPs)

c. Servlets have the advantages like ease of development & platform independence (like Java)

d. They can access all the J2SE and J2EE APIs

e. Can take the full advantage & capabilities of the Java programming language

1 answer


The Http Request

When a user hits a URL with a servlet at the other end, the Servlet Container creates an HttpServletRequest object. It passes this object as an argument to the servlet's service methods (doPut(), doGet(), and doPost()). There is a lot of information in this object, including the login details of the user making this request and the name of the HTTP method with which this request was made.

1 answer


Java Server Page is a standard Java extension that is defined on top of the servlet Extensions. The goal of JSP is the simplified creation and management of dynamic Web pages. JSPs are secure, platform-independent, and best of all, make use of Java as a server-side scripting language.

1 answer


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/

2 answers


A JSP is typically oriented more towards displaying information, and a servlet is more oriented towards processing information. For example, a JSP might display a report, while a servlet would process a user submitted form. These uses are not exclusive, but they are optimized more for performing tasks in this manner. It is much easier to incorporate HTML coding into a JSP than a Servlet. It is also easier to write more complex Java code in a servlet.

1 answer


Advanced Java refers to the specialized and extended features of the Java programming language beyond the basics (Core Java). It includes topics like JDBC, Servlets, JSP, Web Services, and frameworks like Spring and Hibernate, enabling the development of web-based, distributed, and enterprise-level applications. It is commonly used in building dynamic and complex software systems.

3 answers


To import javax.servlet in NetBeans 6.8, you need to ensure that your project is set up as a web application. Right-click on your project in the Projects pane, select "Properties," and then go to the "Libraries" category. Click on "Add Library," choose "Java EE" or "Servlet API" from the list (if available), or manually add the servlet JAR file from your local installation if it's not listed. After that, you can import the javax.servlet package in your Java classes.

1 answer


A JSP is typically oriented more towards displaying information, and a servlet is more oriented towards processing information. For example, a JSP might display a report, while a servlet would process a user submitted form. These uses are not exclusive, but they are optimized more for performing tasks in this manner. It is much easier to incorporate HTML coding into a JSP than a Servlet. It is also easier to write more complex Java code in a servlet.

AnswerJSP has Implicit objects and Servlets do not. AnswerJSP and Servlet both define the server end functionality to provide dynamic outputs ,As we know our HTML is only the client end technology version which runs on client browser. JSP and Servlet differ each other in terms of represntation and execution cycle. Servlet are full functional java codes that define the output like write to stream files in protocol defined ways, JSP on the other hand is Role Sepated format to do so where a ordinary web designer designes how will be the presentation of the data and Programmer defines the functinality to provide the underlying things represented in conditional and non conditinal ways , But here is the magic of JSp that merges the both HTML represntation mixed with JAVA scriptlets.

Look at http://www.jsptube.com/jsp-tutorials/jsp-introduction.html, it explains how does JSP differs from servlet.

2 answers