Java Server Pages and Common Gateway Interface (CGI) usually provide the same program functionality. But there are few advantages or features only offered by the Java Server Pages. • JSP provided support to use and embed expressions and dynamic elements in HTML page. Where as in CGI, a separate CGI file is used for the same purpose. Thus Java Server Pages provides better performance as compared to CGI. • A JSP page is compiled by the web server before it is processed or invoked. ...
Java Server Pages is a well known technology for web based application development. It supports: • Dynamic content handling • Insertion of Java code as expression element in HTML tags. • Use of special JSP tags Most of the JSP tags start with “<%” and these tags ends with “%>”. Java Server Pages are compiled to Servlets and are a specific type of servelts however it offers more benefits over the traditional servlets. Also Java Server ...
Java Server Pages provides support for two types of object sharing. This object sharing is achieved using cooperating tags. • In first approach, an object is given a name and page context is used to store this object. The page context is implicit object that can be accessed by tag handlers and JSP pages. The following command is used to access a shared object that has been given a name. Java Code: pageContext.getAttribute( name, scope ); • In second approach of ...
pageContext.getAttribute( name, scope );
The Java Server Pages container invokes the tag handler object in order to evaluate custom tags that are referened by other tags while JSP page is being executed. The Java Server Pages implementation class calls the tag handler methods at different phases of tag evaluation. The Java Server Pages invokes the doStartTag method handler so that an appropriate method handler is initialized when ever a start tag is encountered of a custom tag. The Java Server Pages invokes the doEndTag ...
The programming language objects are created and accessed using action elements in Java Server Pages and the output stream is affected. There are 6 standard actions that are defined in the JSP specification and the JSP compliant implementation must provide these standards. The custom actions which are reusable modules are also supported by the JSP technology in addition with standard actions. The custom tag in a JSP page is used to invoke the customer action. The custom tags collection makes ...
The protocol treats all the HTTP requests as a String. It may include Boolean, integers, dates, numbers, decimals and everything. According to HTTP protocol, everything is a string. As compared to this approach, the struts class supports the data types and it has properties. Different types of converters are used by the struts so that it can perform heavy lifting. For example, in your Action class you have a specific data type like integer; it will be automatically converted into integer ...
In order to make products and services compatiable with local cultures and languages, the internationalization process is used. Localization is a process that plans implement products and services and make them adaptable to specific culture and language. The internationalization process is also refered as localization enablement or translation. Internationalization is also abbreviated as i18n. • It starts with i. • It ends with n • It contains 18 characters between ...
Struts2 is a MVC/MVC2 framework from a high level view. The following 5 components provide the Struts2 Model View Controller Pattern. • Interceptors • Actions • Value Stack • View • Results In Struts2 the actions take the model role instead of controller so it is little different from the traditional Model view controller framework. But there is always a overlap between the two. Architecture ...
Struts2 provides a lot of good features and functionalities but there also few disadvantages of Struts2 in specific environments and conditions. We will discuss the disadvantages of Struts2 in this topic. • Bigger Learning Curve: In order to use Struts MVC framework, you must have expertise with JSP, Servlet API and the Struts framework. • Poor Documentation: Struts2 offers limited online resources for learning as compared to standard JSP and Servlet API. Also the new user ...
Struts2 is a mature and very popular MVC design pattern based web application framework. In Struts2, the complete architecture is rewritten as compared to Struts 1. The Struts framework provided the base for WebWork framework and basically it was designed to provide improved and better framework built on top of Struts so that developers can easily develop web applications. After a while, Struts community and WebWork framework developed Struts2 framewrok with combine efforts. ...
Following are the benefits offered by the Spring Framework. • It is possible to develop enterprise level application in Spring using POJOS. The major benefit of using POJO is that you can avoid EJB container like application server. In such cases you just need to use a web server like Tomcat or any other commercial product. • A modular style is used to organize Spring. There are lot of packages and classes but you must only consider the classes being used by you. • The spring ...
For Java enterprise application development the most popular development framework is Spring. The Spring framework is being used by the million of developers around the work. It is possible to create easily testable, high performing and reusable code. The Spring is an open source Java platform based Framewrok. The Spring framework was first released in June 2003 under the Apache 2.0 license and it was written by Rod Johnson initially. When considering the transparency ...
The Spring framework has great support for Log4J and it is easy to use Log4J for logging inside Spring applications. In this section, we will discuss the Log4J and Spring integration and how you can use it. To install the Log4J on you machine, download it from the apache website, extract the zip file and use the log4j.jar in your project. The Jakarta commons loggin (JCL) API provides an alternative approach to support loggin in your Spring application. Jakarta commons loggin API can ...
The DispatcherServlet provides the base for Spring web model view controller framework. The DispatcherServlet handles all the HTTP responses and requests. The below diagram explains the request processing workflow based on the Spring Web MVC DispatcherServlet. Spring Servlet Dispatcher For an incoming HTTP request, following sequence of events are generated. • The HandlerMapping is consulted to call the related Controller when ...
The model view controller architecture is provided by the Spring Web MVC framework and it also provides ready components which are used to generate loosely coupled and flexible web applications. The different application aspects are separated in result of MVC pattern like business logic, input logic and UI logic. This pattern will provide loose coupling between the elements. • The model data is encapsulated by the Model and it is consist of POJO in general. • The model data ...
The Spring supports the following two types of transaction management. • Programmatic Transaction Management: In this type of transaction management, you will manage the transaction in your code. This transaction management provide you extreme flexibility and at the other end it is hard to manage and maintain. • Declarative Transaction Management: In this transaction management, the business code is separated from the transaction management. The XML based configuration or annotations ...
A sequence of actions which make a single work unit is a database transaction. This sequence of actions must be completely taken effect or discarded at all. The most important part of RDBMS based enterprise applications is transaction management which ensure consistency and data integrity. Following are the four main properties of transactions which explain it. • Atomicity: A single unit of operation best describes the transaction. So that is either successful or not as a single unit of operation. ...
Following functions are performed by JdbcTemplate class. • Execute update statements • Execute queries • Stored procedure calls • ResultSets iteration • Returned parameter extraction • Cache JDBC exceptions • Transalation of JDBC exceptions into generic and informative exceptions that are defined in spring dao package Once JdbcTemplate instance are configured, they are thread safe. It is possible to use a single JdbcTemplate ...
It is cumbersome to write useless and unnecessary code when working with the database using old JDBC which is old and plain to handle database connections and exceptions etc. All the minor details are handled by the Spring JDBC framework like open a database connection, prepare a SQL statement, execute a SQL statement, handle transactions, process exception and close a database connection. You job is to only define the parameters for database connections and SQL statements so that ...
The Aspect Oriented Programming (AOP) framework is the key Spring framework component. Program logic is breaked down into unique parts by the Aspect Oriented Programming which are called so-called concerns. The cross cutting concerns are the functions of an application which are based on multiple points. The application business logic is seprated from cross cutting concerns conceptually. Following are the examples of aspects: • Auditing • Logging • Declarative transactions ...
The ApplicationEvent class and ApplicationListener interface provide the event handling in the ApplicationContext.For each ApplicationEvents that is published to ApplicationContext the bean which has implemented the ApplicationListener is notified. Following events are provided by the Spring. • ContextRefreshedEvent: At the initializion or refreshing of ApplicationContext, ContextRefreshedEvent is generated. Also the refresh() method is used to generate this event on ...
The dependency injection can be configured using annotations in Spring 2.5 and above. The configuration of bean class can be done in class itself as compared to XML based bean wiring with the use of annotations on relevant method, class or field declaration. The XML injection is performed after the annotation based injection so the XML injection will override the annotation injection. The Spring container will not turn on the annotation wiring by default. So you will ...
The relationship can be auto wired by the Spring container between collaborating beans. It will reuce the overhead of writing large XML configuration for big Spring based applications. For dependency injection, following autowiring modes are used by the Spring container. • no: This mode is the default mode and it means that no autowiring and explicit bean referencing should be used for wiring. For this wiring, you do not need to use anything special. • byName: ...
A few working object makes a java application which is seen by the end user as a working application. The application classes must be independent and loosely coupled in case of complex and large Java applications from other Java classes in order to increase reusability chances. Also this approach makes the testing process easy in the unit testing of complex Java application. These classes are integrated together by the dependency injection also known as wiring and it also takes the same amount of ...
Following information is contained by a bean definition: • Configuration information • Constructor arguments information • Container specific information like method initialization • Property values information • Names of static factory methods Configuration data is inherited from the parent definition by the child bean definition. Some values are added or overridden by the child definition. There are no direct concerns between the java class ...
The callback methods are defined by the Bean Post Processor interface and it can be implemented to provide your instatiation logic and dependency resolution logic. When the instantiating, initializating and configuring of a bean is finished by the Spring container, some custom logic implementation can be done by you by integrating Bean Post Processor implementations. More than one Bean Post Processor interfaces are allowed to use and configure and also it is possible to control the ...
It is easy to understand the Spring Bean Life Cycle. It is required to perform some initialization on the instantiation of a bean so that it can enter into a usable state. When a bean is not required, some cleanup process is required to remove the bean from the container. There is a list of activities which are performed behind the scenes during the life of bean instantiation and destruction. Here we will discuss only two important methods of bean life cycle callback. These methods ...
You can easily declare the bean scope for the bean when you define a bean in Spring. Whenever a new bean instanace is required by you, bean scope attribute is declared as prototype to force the Spring to produce the bean instance. Also whenever you are looking for the same bean instance from the Spring, the bean scope instance is declared as singleton. The following five scopes are supported by the Spring framework. In case of a web aware ApplicationContext, only three scopes are available. ...
The beans are the object that forms the backbone of any application and the Spring IoC container manges these beans. The Spring IoC container is responsible for instantiating, assembling and managing of a bean object. The configuration metadata is used to create these beans which are sent to container. For example, they are sent in the form of XML configurations. The configuration metadata information is contained by the bean definition which is required to know the following by the ...
The Spring framework core is the Spring container. The Spring IoC container will: • Create objects • Wire those created objects • Configure thos objects • Manage complete lifecycle of the object An application is made up of components and these components are managed by the Sping container using dependency injection. These objects are also known as Spring Bean objects. The configuration metadata is read by the Spring container in ...
Size Reduced for Images in PDF &...
05-15-2013, 05:53 PM in Java Software