History of JSP & Servlets
The internet's original purpose was to access and copy files from one computer to another. While TCP/IP provided a highway layer, the File Transfer Protocol (FTP) specification provided a standard way to exchange those files. It defined a way of shuttling them back and forth, but said nothing about looking at the content. HyperText Markup Language (HTML) allowed us to see the documents on the Internet. FTP can transmit HTML files just as easily as HTTP can. But we use Hypertext Transfer Protocol (HTTP) to act as an FTP specifically for HTML documents because it is a stateless protocol which makes having many short connections more efficient.
HTTP is the Plumbing that connects the various computers. Now it is time to discuss about the fluid that flows through it "JSP & Servlets"
Note: JSP & Servlets arent the only technologies that are used in J2EE applications. Struts, Hibernate, Springs etc are other technologies that are used in J2EE Web applications. But, don't worry about them because they arent in the exam.
Using HTTP and HTML people were able to view/browse files and contents on a remote server. This is very useful, but people wanted live data. This is where the CGI (Common Gateway Interface) specification helped us. It helped us connect to databases and display stuff on the fly. The CGI specification was a major breakthrough in Web Application Development. The CGI standards made sure that the same CGI program worked on different Web servers.
CGI became the bread and butter of web developers. It was the most common means of displaying dynamic content on the internet. Though it was good, it wasn't good enough. It was not able to handle the performance requirements of the bursting Internet users. It was literally too much for it.
If you are asking me why CGI couldn't handle the load, the answer is simple. CGI spawned a separate process for every request that it receives. This design was able to sustain during off-peak hours but ate off server resources during peak loads which was eventually too much for it.
With growing numbers of users of web applications, scalability became a key consideration which wasn't CGI's Middle Name and hence people started exploring other options.
Many CGI derivatives came up as server-side programming solutions that implement business logic, including ASP, ColdFusion, PHP, and Perl. Java surpassed them all due to portability and its object oriented programming design.
Alas, he we are, learning JSPs and Servlets that are the children of the Java Family which make our lives all the more easier in the world of Web Development.
Java was conceptualized in 1991 but it wasn't in the internet programming world until 1997. Servlets were the alternative to CGI and were released in 1997. Unlike CGI, which starts a process for each request, Servlets just spawn a new thread. Servlets had a better or rather efficient architecture which was able to handle the loads of the internet.
Though Servlets were awesome when compared to CGI, they still had some issues when it came to displaying dynamic content on a web page. Thankfully, Sun released the JSP (Java Server Pages) specifications in 1998, which solved all our UI woes. JSPs enabled programmers to display dynamic HTML content that could also use Java features. The combination of JSPs and Servlets was just what the Doctor Prescribed and it just revolutionized the Web Programming industry
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.
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.
Networking is a basic action. A servlet in Java is a single part of networking, a single task.
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.
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 serversA 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.
No. Javascript code can be present inside a JSP but not inside a servlet. A Servlet is a pure java class.
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.
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.
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.
Perl, php and Java are all examples of programming languages.
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.
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.