Tag Archives: JEE

Spring Framework Vs. JEE – Part III

This is my final blog on this topic, hopefully. Part I of the blog can be found in here and Part II of this blog can be found in here.

I do at times think that my blog title itself is misleading or rather incorrect as I don’t feel that there needs to be a comparison between the two as both can exists together in one application without any issues at all. In fact if that’s the case we can use the best of both and be happy. But, there does exist this debate for a very long time and now a days Oracle also at times gives a comment to kill Spring Framework (buy and kill it to reduce competition, Oracle’s buying spree logic) and go with standards. Being the creators and maintainers of the Java language they do have the right to promote JEE but I feel they don’t have to have such a stance IMHO.

The community with full adoption of language has made it to a be a standard. Similarly when Spring Framework came in existence it was indeed helping Java developers use Java and avoid the complexities to develop enterprise application. In fact we have to give full credit to Spring Framework in keeping Java language alive and kicking. I have heard many times, even from my own managers that Java is too heavy and not that good for application development when you compare .NET. Spring to some extent have been bale to bring that easiness to it by taking the complexities away. At the moment also there might not be that much comparison between easiness with respect to .NET, but community is ready to develop applications using Java. Again for enterprise application comparing .NET and Java (JEE) is not that of a good idea because of so many reasons. Don’t want to divulge too much off the topic here.

As Kelly Tisdell mentions in his blog, JEE has definitely taken some page out of Spring Book and added onto its big Java bible and spreads a word across that “Java is standard, so migrate to JEE from Spring to be in standard”. It doesn’t say directly that stop using Spring but it has that tone in it.

Even after taking those pages, to develop an enterprise application from scratch using JEE does have its won complexities and Spring does have that easiness to it (might be subjective and debatable, but that what i feel). Most of nicer features in Spring has now crept into JEE under different names and much refined fashion (JEE have learned from mistakes and corrected it) for sure and that’s the reason developers have been prompted to think for this migration.

I wanted to put more facts in here rather than my opinions, but after so long I have indeed lost interest in filling in more details and i thought that i will just give my opinion and close this not so ending blog post.  Apologies for same.

In my opinion, Spring and JEE should marry each other and an enterprise application should be developed taking into good points from both. I am in no way saying that JEE or Spring scores over the other because both are really good platforms to develop your enterprise applications.

Page Visitors: 305

Spring Framework Vs. JEE – Part II

As promised this is my second part of my blog. The first part of the blog can be accessed from here.

As part writing this blog i browsed through various blogs on the same topic. As i told in my first blog, this really is a holy war and over coming few months and years, this will rage even harder.

I bust out into laugh after reading one of the blogs, the link for which is as given below:-

http://broadleaf.tumblr.com/post/31333966305/broadleaf-continues-to-choose-spring-framework

The point that i burst outlaughing when the author stated as below:-

<quote>

…… Java EE 5 took a few pages out of Spring’s book and simplified the development of enterprise components with…….

</quote>

Yes, JEE sure did take some very crucial and important pages out of Spring book and because of which it is becoming superior day-by-day if not by huge margin. Spring with full support from its community is not far behind and with foundation in place, its building up components one after another. Its also adding in more and more support for open source libraries with ever growing sub-projects under the Spring Framework umbrella.

Also now its is slowly becoming a norm when considering a new open source for development to see how strongly it can be integrated into Spring and how seamless Spring configurations can be used. In my web service framework comparison, you wouldn’t believe, this was considered as one of the requirements and it will be a bonus for any open source to state that “they can be integrated into Spring” with some few lines of Java or XML configuration.

Spring has an edge by keeping it open for good open source libraries to plug on at any time and replace these libraries with a new one by mere configurations (at-least theoretically possible… :)). Java theoretically is “Write once run anywhere”, but is it truly that easy for a a production application to move from one environment to a new one… Hmmm… I don’t think so… 🙂

I am sort of exhausted already writing this blog. I will have to put you all in some suspense and put everything else that i plan to write in a new blog part. Hold on tight and i am sure i wouldn’t make you unhappy. Expect third part in another 3 days time. Its weekend here and i am really looking forward to it in a big way.

Page Visitors: 379

Spring Framework Vs. JEE – Part I

Am I playing with fire here. Perhaps Yes.

As many say, this truly classify itself to be a holy war for predominance and will surely stir some dirty stuff out into the air.

One of my colleagues recently came to me and had a small debate as to why the our organization selected Spring over JEE. He was very much in favor of JEE especially JEE 6.

We sometime back (more than an year) had an exercise in which the task was to choose organization wide Java framework. As you guessed right, we did have Spring Framework and JEE as strong candidates. Our approach was really methodical and a methodology which was devised internal to the organization was used.

In this methodology the two candidates was put into test. First of all, various architecture quality attributes were put in such as Performance, Scalability, Testability etc. and then various requirements in these attributes were classified/grouped together. Once we have that, we get the various stakeholders involved and get their buy in and their stand on the overall acceptance of these quality attributes and rank it. We then went on with POC (Proof of Concept) and each requirement was rated against each of the chosen frameworks.

Finally after a grueling exercise of rating various requirement for each of the framework, a final rating comes out which give good indication as to which on quality attributes gets favored for each of the framework and according to the stakeholders, which one to choose out of these two. The choice was made and there was no surprise, it was Spring Framework.

For our company now the chosen default framework is Spring and anything else if it is taken, it goes as an exception.

For me when i say that i use Spring Framework, it doesn’t in any way mean that i don’t use JEE. They cannot be mutually exclusive, rather when combined together, it gives immense advantage to the project that you are developing. We do use Spring as our choice of framework but haven’t just taken out JEE in any sense out of the window, rather when the right time comes another evaluation as detailed above will be done to asses the situation even further. Till that time i feel choosing Spring as the default framework is a good one in all aspects.

In my next blog (Click here), I would try to give some of the major points, which made us choose Spring as a default framework of choice for developing any application within the organization.

Earlier i have done couple of comparisons as detailed below:-

Spring Integration Vs. Apache Camel

Web Service Framework Comparison – 2013 – Part I

Web Service Framework Comparison – 2013 – Part II

Page Visitors: 1054

Spring – Application Monitoring – Performance Monitor

Thanks to my colleague for sharing this info on application monitoring using out of the box spring interceptors.

To put in place performance monitoring of service methods (methods annotated with @Service), do the following.

The interceptor class which will be used for this is org.springframework.aop.interceptor.PerformanceMonitorInterceptor.

In your spring application context configure the interceptor as below:-

The logger has to be set at trace level for the logging to happen

Page Visitors: 1814

Spring Book – Chapter 1 – Introduction

Over the last few years, Spring has grown substantially, surpassing many other frameworks. Spring enables you to concentrate on writing less Spring-Framework-related code and more application code, which is vital in the fast-changing and cost-sensitive world of enterprise applications. Since its initial release in 2004, Spring has reinvented itself multiple times and become prominent in the industry as a strong force in the framework market. This has not only made the Spring Framework renowned, but it has also put healthy pressure or rather competition on well-known industry specifications (Java EE) and the application-server market. In the Java world, this is a very exciting time and a very important turning point.

In this chapter, I introduce Spring Framework as a whole (If I could, I would compel you to use it). Before explaining the nitty-gritty, I give you reasons to choose Spring for your application. Then I explain the Spring framework architecture and its features and, more important, introduce you to the main modules on which Spring Framework is based.

Why Spring?

Spring provides an extensive, portable, open source-application-development framework for Enterprise Java. Starting with Spring, you can build whatever you want: reservations system, banking systems, social networks, and more. Spring expands to meet your needs; you can integrate various security models, databases, web services, mobile clients, messaging systems, and so on that are required in today’s agile enterprise applications. Another key advantage is that Spring fits directly into your current infrastructure, because Spring uses the same Plain Old Java Objects (POJOs) you use every day. Once you start creating applications with Spring, you can deploy it everywhere in the certainty that it will thrive and adapt to the environment with ease.

If you need your application to be better, newer, and speedier, Spring is the right alternative for development. Surveys suggest that more and more Java developers around the world are moving toward Spring. For instance, recent analysis from Evans Data (“Spring Usage Study,” Evans Data Corporation, September 2011) analyzes the ubiquity achieved by Spring as summarized below:

  • Spring is the framework of choice among knowledgeable Java developers.
  • Spring developers report productivity and speed of deployment as the top reasons for using it: 70 percent of Spring users report at least a 50 percent productivity gain by using it, and 73 percent report that the framework allows them to deliver projects twice as fast.
  • It is estimated that more than two thirds of Java developers today are either using Spring or plan to do so within the next two years.
  • More than half of all existing Spring users expect to considerably increase their use of this framework over the next few years.
  • Spring users are more cloud ready and it is considered that heavy Spring adopters are more likely to have already deployed their applications to the cloud.
  • More than half of all existing Spring developers report that they plan to move their Java applications to a lightweight server, such as Apache Tomcat, within one year. ( Get more information from http://www.vmware.com/company/news/releases/vmw-spring-momentum-3-14-12.html )

Shared feedback from developers around the world highlights the following advantages of Spring Framework:

  • Easier to understand. Not rocket science.
  • If you have any issues with the framework code, you can just open the source code and with minimal effort understand it very easily.
  • Makes users highly productive, shortens development time.
  • For junior developers, it’s an excellent learning tool because so many live, proven Java pattern examples can be seen throughout the framework code.
  • Enables developers to cut out tons of redundant code, reducing boilerplate code in their applications. Programmatic catching of exceptions and cleaning up of resources, etc., are things of the past.
  • Spring’s ability to wire objects at runtime is incredible. Injection of right type-safe objects wherever needed is transparently handled by the Spring container.
  • A la carte framework—Plug-in what you want and use it.

What Is Spring Framework?

Spring Framework is built on well-defined goals and a coherent philosophy. Its main aim is to make Java EE development easier. This section explains Spring Framework’s main goals and its role in the development of enterprise applications.

Goal

Spring’s main aim, according to Rod Johnson (see sidebar) is to make Java EE easier to use and promote good programming practice. Even though POJO-based programming model is practiced in many enterprise applications, Spring Framework takes this concept into a different level by incorporating this model into it and making it applicable in a wide range of environments available. Due to this style of programming model, the framework keeps itself open to take advantages provided by the environment it works on without losing portability in the process.

Rather than Spring writing its own bit of code for common functionalities like logging, connection pools, transaction coordinators etc., it allows the developers to appropriately plug in the various packages available as open-source projects (For example, Commons Logging package can be used for all common logging purposes, Commons DBCP package can be used for connection pooling etc.) into the framework with mere configuration and with ease. By doing so it allows using the best package available in the open-source world and also keeps it open for future change as the case may be. All of this Spring does by keeping in mind that it doesn’t gets itself locked to any platform-specific or non-standard technology making it one of reason to use the framework in any enterprise application development.

Spring over the period has grown into a mature framework transforming itself into a one-stop shop capable of handling most of the infrastructural concerns which exists in a typical modern enterprise application. Applications are there because it has to support a business requirement. Spring provides applications with the capability of taking care of your core business objects easily and also allows changing it with minimal impact on the application as a whole according to changing business scenarios.

Rod Johnson is an enterprise Java architect specializing in scalable web applications. He has worked with both Java and JEE since their release and is also a core member of JSR 154 Expert Group entrusted with defining the Servlet 2.4 specification. He started developing frameworks for web application in 2000 while working as independent consultant. The Spring project was started by him in 2002, and it first official release was in March 2004. Johnson released this framework with the publication of his book Expert One-on-One Java EE Design and Development (Wrox Press, 2002).

Spring Framework’s Role in Enterprise Applications

Spring Framework includes core support for:

  • Application configuration
  • Enterprise integration
  • Data access
  • Testing
  • Web application-development support
  • Enterprise application-development support

Application Configuration

A typical application comprises various components working together to carry out a particular application-use case. Spring helps you build this configuration with ease. With Spring, components constituting a use case don’t worry about one another and at any point they can be swapped to keep up with the business change (agility).

Enterprise Integration

An enterprise application doesn’t work in isolation. It requires various enterprise services and resources such as security, messaging, caching, transactions, etc., to constitute an end-to-end application to meet real-life application needs. With ease and agility, Spring does this by keeping your application code simple and both unit and integration testable. It can be easily plugged into any standard Java EE application server and also is capable of stand-alone usage.

Data Access

An enterprise application accesses data stored in a relational database to carry out various business functions and to enforce various business validations. Spring makes data access easy and effective. It supports all major data-access technologies, such as Hibernate, JPA, JDBC, etc.; manages these resources transparently from the developer; and also offers tons of APIs, which enables developers to concentrate more on the core business coding and thereby increase productivity.

Testing

Unit and integration testing is essential for any enterprise application. It helps with decompiling objects from the environment where it resides and makes it easier to test the application in isolation from its actual deployment environment. More important, it helps in system/integration testing to see that all the components constituting an enterprise application work properly. This testing can be done in the actual environment as well as in isolation from the actual environment, which is a big plus compared to other framework platforms.

Web Application-Development Support

Spring includes a powerful and highly configurable Model-View-Controller web framework called Spring MVC. Even though very much similar to Apache Struts, it can never be said as derived from it. Frankly saying no copyright infringement spotted.  Now to look into the similarities, Struts Action class is similar to Spring MVC Controller class and this object is multi-threaded in nature will a single instance being used for servicing all the clients.  Spring MVC has some significant advantages over Struts, however—it has a powerful navigation rule framework, Spring Web Flow, which equals its powerful web framework for application development. Even though Spring has its own implementation for a web framework, it has kept its main goal of seamlessly integrating with other famous web frameworks, such as Struts and Java Server Faces (JSF).

Enterprise Application-Development Support

Spring’s core strength lies in its ability to integrate with common and most required services in enterprise applications. It has modules for creating and maintaining web services, scheduling jobs, integrating with messaging services, and so on. This modular coding support ensures good manageability for applications.

Page Visitors: 2300

Basic EJB FAQ – Part 1

1)Who is EJB technology for?

EJB technology benefits a number of audiences:

Enterprise customers that build and/or deploy EJB-based applications – gain development productivity, can choose from a wide selection of EJB servers, create business logic that runs everywhere and is architecture independent, all this while protecting their existing IT investment!

ISVs and SIs that develop EJB components or applications based on EJB components – Invest in business logic that is widely deployable, across any OS and middleware, don’t need to choose one vendor-specific server platform. Like enterprise customers they also benefit from productivity gains and architecture independence

The EJB specification itself is mostly targeted at the EJB server vendors – It is the blueprint that instructs these vendors on how to build an EJB server that EJB components can execute on successfully

2)What are the design goals of the Enterprise JavaBeansTM architecture?

The Enterprise JavaBeans specification defines a standard architecture for implementing the business logic of multi-tier applications as reusable components. In addition to Enterprise JavaBeans components, the architecture defines three other entities: servers, containers, and clients. This architecture incorporates several design goals:

Enterprise JavaBeans servers are designed to wrap around legacy systems to provide fundamental services for containers and the components they contain.

Enterprise JavaBeans containers are designed to handle details of component life-cycle, transaction, and security management. By interceding between clients and components at the method call level, containers can manage transactions that propagate across calls and components, and even across containers running on different servers and different machines. This mechanism simplifies development of both component and clients.

Component developers are free to focus on business logic, since containers provide services automatically by interceding in component method calls. A simple set of callback interfaces are all that a developer needs to implement to participate in container provided services.

A client’s view of an Enterprise JavaBean remains the same regardless of the container it is deployed in. Any container in which an Enterprise JavaBean is deployed presents the same interfaces to the client. This extends to containers from different vendors, running against different servers and different databases, on diverse systems on a network. This client transparency ensures wide scalability for multi-tier applications.

Along with container managed transactions, the Enterprise JavaBeans architecture enables component- and client-managed transactions. Containers can participate in component or client initiated transactions to enforce transaction rules across method call and component boundaries. Components can also specify transaction types by method, enabling them to mix transaction types within a single object.

A variety of Enterprise JavaBean attributes, including the default component transaction type, can be specified at either development or deployment time, and enforced through mechanisms built into the container architecture.

The Enterprise JavaBeans architecture is based on the Java programming language, so enterprise Beans take full advantage of the “write once, run anywhereTM” standard.

3)What’s the client view of an Enterprise JavaBeans component?

The client view is provided through two interfaces — the home interface and the remote interface. These interfaces are provided by classes constructed by the container when a bean is deployed, based on information provided by the bean. The home interface provides methods for creating a bean instance, while the remote interface provides the business logic methods for the component. By implementing these interfaces, the container can intercede in client operations on a bean, and offers the client a simplified view of the component.

4)Why doesn’t the client interact with an Enterprise JavaBean directly?

To the client, there appears to be direct interaction with an Enterprise Java Bean through the home and remote interfaces. However, Enterprise JavaBeans architecture is designed to enable clients and components to exist in different runtimes on different systems on a network. The container intercedes between client and component, completely concealing both the bean instance and its own actions from the clients.

5)What methods are developers required to implement the Enterprise JavaBeans architecture?

There are three categories of Enterprise JavaBeans methods. First, the bean implements methods corresponding to those in its home interface — methods largely for creating, locating and accessing instances of the bean. Second, a bean implements business logic methods corresponding to those provided by its remote interface. Finally, a bean implements methods for interacting with the container. Since these methods aren’t intended for client access, they are hidden by the container.

6)What specific services does a container provide for an entity bean?

As with session beans, the tools for a container generate additional classes for an entity bean at deployment time to implement the home and remote interfaces. These classes enable the container to intercede in all client calls on the same entity bean. The container also generates the serializable Handle class, providing a way to identify the entity bean within a specific life cycle. These classes can be implemented to mix in container-specific code for performing customized operations and functionality. In addition to these custom classes, each container provides a class to provide metadata to the client. Finally, where specified by a particular bean, a container manages persistence of selected fields of the entity bean.

7)What’s the difference between container-managed and bean-managed persistence?

In container-managed persistence, entity bean data is automatically maintained by the container using a mechanism of its choosing. For example, a container implemented on top of an RDBMS may manage persistence by storing each bean’s data as a row in a table. Or, the container may use Java programming language serialization for persistence. When a bean chooses to have its persistence container managed, it specifies which of its fields are to be retained.

In bean-managed persistence, the bean is entirely responsible for storing and retrieving its instance data. The EntityBean interface provides methods for the container to notify an instance when it needs to store or retrieve its data.

8)How is an entity bean created?

An entity bean can be created in two ways: by direct action of the client in which a create method is called on the bean’s home interface, or by some other action that adds data to the database that the bean type represents. In fact, in an environment with legacy data, entity objects may “exist” before an Enterprise JavaBean is even deployed.

9)How does the client get a reference to an existing entity bean?

A client can get a reference to an existing entity bean in several ways:

Receiving the bean as a parameter in a method call

Looking the bean up through a finder method of the home interface

Obtaining the bean as a handle, a runtime specific identifier generated for a bean automatically by the container

10)How do you determine whether two entity beans are the same?

By invoking the EntityBean.isIdentical method. This method should be implemented by the entity bean developer to determine when two references are to the same object. Note that the equals and hashCode methods of Object are undefined for entity beans, since clients don’t directly access bean instances within a container.

11)How does a container manage access from multiple transactions on an entity bean?

Containers manage multiple transactions in one of two ways. First, the container can instantiate multiple instances of the bean and let the transaction management of the DBMS handle transaction processing issues. Or, the container can acquire an exclusive lock on the instance’s state in the database, and serialize access from multiple transactions to this instance.

12)How do enterprise beans handle concurrent and loopback calls on entity beans?

Concurrent calls in the same transaction context on the same Enterprise JavaBean component are illegal and may lead to unpredictable results. A bean can be marked as non-reentrant by its deployment descriptor. This allows the container to detect and prevent illegal concurrent calls from clients. On the other hand, some entity beans may require loopback calls: that is, calls where bean A is invoked, in turn invoking bean B, which then invokes a method call on bean A. This kind of concurrency is tricky and is best avoided.

Page Visitors: 369

Basic Java FAQ – Part 3

101) What is RMI architecture?

Ans: – RMI architecture consists of four layers and each layer performs specific functions:

a) Application layer —- contains the actual object definition

b) Proxy layer —- consists of stub and skeleton

c) Remote Reference layer —- gets the stream of bytes from the transport layer and sends it to the proxy layer

d) Transportation layer —- responsible for handling the actual machine-to-machine communication

102) What is UnicastRemoteObject?

Ans: All remote objects must extend UnicastRemoteObject, which provides functionality that is needed to make objects available from remote machines.

103) Explain the methods, rebind( ) and lookup() in Naming class?

Ans: rebind( ) of the Naming class(found in java.rmi) is used to update the RMI registry on the server machine.

Naming. rebind(“AddSever”, AddServerImpl);

lookup( ) of the Naming class accepts one argument, the rmi URL and returns a reference to an object of type AddServerImpl.

104) What is a Java Bean?

Ans: A Java Bean is a software component that has been designed to be reusable in a variety of different environments.

105) What is a Jar file?

Ans: Jar file allows to efficiently deploying a set of classes and their associated resources. The elements in a jar file are compressed, which makes downloading a Jar file much faster than separately downloading several uncompressed files.

The package java.util.zip contains classes that read and write jar files.

106) What is BDK?

Ans: BDK, Bean Development Kit is a tool that enables to create, configure and connect a set of set of Beans and it can be used to test Beans without writing a code.

107) What is JSP?

Ans: JSP is a dynamic scripting capability for web pages that allows Java as well as a few special tags to be embedded into a web file (HTML/XML, etc). The suffix traditionally ends with .jsp to indicate to the web server that the file is a JSP files. JSP is a server side technology – you can’t do any client side validation with it.

The advantages are:

a) The JSP assists in making the HTML more functional. Servlets on the other hand allow outputting of

HTML but it is a tedious process.

b) It is easy to make a change and then let the JSP capability of the web server you are using deal with compiling it into a servlet and running it.

108) What are JSP scripting elements?

Ans: JSP scripting elements lets to insert Java code into the servlet that will be generated from the current JSP page. There are three forms:

a) Expressions of the form <%= expression %> that are evaluated and inserted into the output,

b) Scriptlets of the form <% code %> that are inserted into the servlet’s service method, and

c) Declarations of the form <%! Code %> that are inserted into the body of the servlet class, outside of any existing methods.

109) What are JSP Directives?

Ans: A JSP directive affects the overall structure of the servlet class. It usually has the following form:

<%@ directive attribute=”value” %>

However, you can also combine multiple attribute settings for a single directive, as follows:

<%@ directive attribute1=”value1″

attribute 2=”value2″

attributeN =”valueN” %>

There are two main types of directive: page, which lets to do things like import classes, customize the servlet superclass, and the like; and include, which lets to insert a file into the servlet class at the time the JSP file is translated into a servlet

110) What are Predefined variables or implicit objects?

Ans: To simplify code in JSP expressions and scriptlets, we can use eight automatically defined variables, sometimes called implicit objects. They are request, response, out, session, application, config, pageContext, and page.

111) What are JSP ACTIONS?

Ans: JSP actions use constructs in XML syntax to control the behavior of the servlet engine. You can dynamically insert a file, reuse JavaBeans components, forward the user to another page, or generate HTML for the Java plugin. Available actions include:

112) How do you pass data (including JavaBeans) to a JSP from a servlet?

Ans: (1) Request Lifetime: Using this technique to pass beans, a request dispatcher (using either “include” or forward”) can be called. This bean will disappear after processing this request has been completed.

Servlet:

request.setAttribute(“theBean”, myBean);

RequestDispatcher rd = getServletContext().getRequestDispatcher(“thepage.jsp”);

rd.forward(request, response);

JSP PAGE:

(2) Session Lifetime: Using this technique to pass beans that are relevant to a particular session

(such as in individual user login) over a number of requests. This bean will disappear when the

session is invalidated or it times out, or when you remove it.

Servlet:

HttpSession session = request.getSession(true);

session.putValue(“theBean”, myBean);

/* You can do a request dispatcher here,

or just let the bean be visible on the

next request */

JSP Page:

3) Application Lifetime: Using this technique to pass beans that are relevant to all servlets and JSP pages in a particular app, for all users. For example, I use this to make a JDBC connection pool object available to the various servlets and JSP pages in my apps. This bean will disappear when the servlet engine is shut down, or when you remove it.

Servlet:

GetServletContext(). setAttribute(“theBean”, myBean);

JSP PAGE:

113) How can I set a cookie in JSP?

Ans: response.setHeader(“Set-Cookie”, “cookie string”);

To give the response-object to a bean, write a method setResponse

(HttpServletResponse response)

– to the bean, and in jsp-file:

<%

bean.setResponse (response);

%>

114) How can I delete a cookie with JSP?

Ans: Say that I have a cookie called “foo,” that I set a while ago & I want it to go away. I simply:

<%

Cookie killCookie = new Cookie(“foo”, null);

KillCookie.setPath(“/”);

killCookie.setMaxAge(0);

response.addCookie(killCookie);

%>

115) How are Servlets and JSP Pages related?

Ans: JSP pages are focused around HTML (or XML) with Java codes and JSP tags inside them. When a web server that has JSP support is asked for a JSP page, it checks to see if it has already compiled the page into a servlet. Thus, JSP pages become servlets and are transformed into pure Java and then compiled, loaded into the server and executed.

Page Visitors: 305