View RSS Feed

All Blog Entries

  1. Exception Handling in JSP

    , 07-07-2012 at 08:30 PM
    There is always a probability of programming errors in the code while a programmer is coding a JSP page. Following are the major types of errors which may arise in a JSP code:

    • Checked Exceptions: The checked exception is an unforeseen error by the programmer of JSP code or it is a user error in the code. For example, you are opening a file which may not exisit or may have some issue will raise an exception. At the compile time, these checked exceptions cannot be ignored.
  2. Hits Counter in a JSP Page

    , 07-07-2012 at 08:29 PM
    You have a website developed in JSP with different pages. The hit counter will help you the total number of users visit your any JSP page. In most cases, the hit counter is attached with “index.jsp” page. It is the main login page and most users will first visit this page before navigating to any other page on your application or website.

    The following methods are used to implement hit counter. These methods are attached with you “Application” object.

    • setAttribute() ...
    Tags: hits counter Add / Edit Tags
  3. Session Tracking in a JSP Page

    , 07-07-2012 at 08:12 PM
    JSP communicates with the clients using stateless HTTP protocol. For each new request, following operations are performed:

    • A new connection is opened with web server.
    • Server does not record client information.

    In this topic, we will focus on the different ways of handling and maintaining session information. Following are the 3 main ways for session maintaining.

    • Cookies: A cookies also known as session ID is assigned to a web client by the ...
  4. Form Processing in JSP

    , 07-07-2012 at 08:10 PM
    In a JSP progam, a programmer may have handled situations in which he sends information from browser to server and finally this information is communicated to backend business logic. Following two methods are used by the web browsers to send form data and information to web server.

    • GET Method: The encoded information is sent from browser to the server using this GET method. The information and page URL is separated using the “?” character. Following is an example of GET method information ...
  5. Expressions in JSP

    , 07-07-2012 at 08:09 PM
    The expression elements are supported by the JSP Page which:

    • Are based on scripting language
    • These expressions are evaluated.
    • These expressions are coverted to a String format
    • These are replaced with the expression elements in the JSP Page.

    The expression elements in a JSP page are finally converted to a string so you can use it anywhere in your JSP Page. These expression elements must be valid and follow the Java Language. There is only ...
  6. How a JSP Page is processed?

    , 07-07-2012 at 08:07 PM
    In this topic, we will dicuss how a JSP Pages is created and processed by a web server. Following steps will explain it in more detail.

    • An HTTP request is sent to the web server by your JSP Page.
    • The web server is responsible for receiving this JSP Page request and it will determine that it’s a JSP request so it will call the JSP engine. This process is done for the pages that have a .jsp extension.
    • The requested JSP page will be loaded from the disk and the JSP ...
  7. What are the Advantages of JSP

    , 07-07-2012 at 08:05 PM
    JSP offers the following advantages as compared to using other technologies in the market.

    • JSP vs Active Server Pages: The major benefit offered by the JSP as compared to Active Server Pages is that it uses Java for expression writing which is more helpful, powerful and easy to use. Where as in Active Server Pages, you will need to use Visual Basic or any other Microsoft language. The second benefit offered by the JSP is that you can port it to any other operating system.
  8. Why we need to Use JSP instead of CGI

    , 07-07-2012 at 08:03 PM
    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. ...
  9. JavaServer Pages Introduction

    , 07-07-2012 at 07:56 PM
    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 ...
  10. Cooperating Tags in JSP

    , 07-07-2012 at 07:55 PM
    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 ...
  11. Tag Handlers in JSP

    , 07-07-2012 at 07:54 PM
    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 ...
  12. Tag Library Introduction

    by , 07-07-2012 at 07:51 PM
    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 ...
  13. Type Conversion in Struts

    by , 07-07-2012 at 07:50 PM
    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 ...
  14. Struts2 Localization and internationalization

    by , 07-07-2012 at 07:47 PM
    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 ...
  15. Architecture of Struts 2

    by , 07-07-2012 at 07:46 PM
    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.

    Name:  1.jpg
Views: 3427
Size:  56.1 KB
  16. Disadvantages of Struts2

    by , 07-07-2012 at 07:44 PM
    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 ...
  17. Struts 2 Introduction

    by , 07-07-2012 at 07:43 PM
    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. ...
  18. Spring Framework Advantages

    by , 07-07-2012 at 07:41 PM
    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 ...
  19. Spring Quick Guide

    by , 07-07-2012 at 07:40 PM
    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 ...
  20. Spring Logging - Log4J

    by , 07-07-2012 at 07:39 PM
    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 ...
  21. Spring Servlet Dispatcher

    by , 07-07-2012 at 07:36 PM
    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.

    Name:  1.jpg
Views: 5950
Size:  28.0 KB
    Spring Servlet Dispatcher

    For an incoming HTTP request, following sequence of events are generated.
    • The HandlerMapping is consulted to call the related Controller when ...
  22. Spring Web MVC Framework

    by , 07-07-2012 at 07:34 PM
    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 ...
  23. Spring Transaction Management

    by , 07-07-2012 at 07:33 PM
    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 ...
  24. Transactions in Spring

    by , 07-07-2012 at 07:32 PM
    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. ...
  25. What is JdbcTemplate Class?

    by , 07-07-2012 at 07:31 PM
    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 ...
  26. Spring JDBC Framework Overview

    by , 07-07-2012 at 07:30 PM
    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 ...
  27. Spring Framework and AOP

    by , 07-07-2012 at 07:27 PM
    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 ...
  28. Spring Event Handling

    by , 07-07-2012 at 07:26 PM
    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 ...
  29. Spring Configuration Based on Annotation

    by , 07-07-2012 at 07:25 PM
    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 ...
  30. Auto-Wiring in Spring Beans

    by , 07-07-2012 at 07:24 PM
    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: ...
    Tags: auto-wiring Add / Edit Tags
Page 2 of 48 FirstFirst 123412 ... LastLast