Simple guide to setup SSL in Tomcat

Author posted by Jitendra on Posted on under category Categories JAVA, JSP, Servlet and tagged as Tags , , with 1 Comment on Simple guide to setup SSL in Tomcat

I have enabled SSL in tomcat many times however initially I struggled to get it in running condition. So I thought to share a simple approach I am following now days.

Step 1:

Run tool “Keytool“ provided by the JRE to create a “keystore file”.
The command to run tool is:

keytool -genkey -alias tomcat -keyalg RSA -keystore D:/.keyStore

Where “D:/.keystore” is the path where file should be created.
Instead of alias “tomcat” any other name can be used.
After running above command, you will be asked many questions, so answer them correctly as shown in below image:

Tomcat SSL keytool to create keystore file
Tomcat SSL keytool to create keystore file

Remember the password provided, as it will be needed in next step. Continue reading “Simple guide to setup SSL in Tomcat”

Tutorial of Simple JSP Tiles application without Struts

Author posted by Jitendra on Posted on under category Categories JSP and tagged as Tags with 17 Comments on Tutorial of Simple JSP Tiles application without Struts

Example of Simple JSP Tiles application without Struts

There are very few resources available on internet which explains step by step integration of tiles in simple jsp page.
Apache Tilesâ„¢ is a templating framework built to simplify the development of web application user interfaces.

Tiles allows authors to define page fragments which can be assembled into a complete page at runtime. These fragments, or tiles, can be used as simple includes in order to reduce the duplication of common page elements or embedded within other tiles to develop a series of reusable templates. These templates streamline the development of a consistent look and feel across an entire application.

Ste p1 : Download the Tiles jar file from here. Continue reading “Tutorial of Simple JSP Tiles application without Struts”

J2EE – Servlet , JSP , JSF and JMS Version Table

Author posted by Jitendra on Posted on under category Categories JSP, Servlet and tagged as Tags with 1 Comment on J2EE – Servlet , JSP , JSF and JMS Version Table

J2EE – Servlet , JSP , JSF and JMS Version Table

Hi Friends,

Below table gives the information about the versions of J2EE (Java Table Version).

 
J2EE 1.2
JEE 5
Servlet2.22.32.42.5 new3 new
JSP1.11.22.0 new2.12.2
JSTL--1.11.21.2
Tomcat4.x5.x5.x6.x7.x
JMS1.0.21.0.21.11.11.1
JSF---1.22.0 new
J2EE Release DateDec 12, 1999Sep 24, 2001Nov 11, 2003May 11 , 2006Dec 2009
EJB1.12.02.13.03.0
Extra Info----JDK 5 and above required

How to Create JSP Custom Tag – using BodyTag interface or BodyTagSupport

Author posted by Jitendra on Posted on under category Categories JAVA, JSP and tagged as Tags with 2 Comments on How to Create JSP Custom Tag – using BodyTag interface or BodyTagSupport

Tutorial on How to Create JSP Custom Tag – using BodyTag interface or BodyTagSupport

In Previous articles, i have explained:

Life Cycle of JSP “Tag” interface.

Life Cycle of JSP “BodyTag” interface.

How to Create JSP Custom Tag – using Tag interface or TagSupport

we have seen that how to create the custom JSP tag using interface “Tag”, means tags which does not have a body. In this article, I will explain creating custom Tags which have a body. We can manipulate the content of body as we want.

How to Create Custom Tag in JSP
How to Create Custom Tag in JSP

Continue reading “How to Create JSP Custom Tag – using BodyTag interface or BodyTagSupport”

How to Create JSP Custom Tag – using Tag interface or TagSupport

Author posted by Jitendra on Posted on under category Categories JAVA, JSP and tagged as Tags with 2 Comments on How to Create JSP Custom Tag – using Tag interface or TagSupport

Tutorial of creating JSP Custom Tag – using Tag interface or TagSupport in JAVA

In Previous two articles, i have explained:

Life Cycle of JSP “Tag” interface.

Life Cycle of JSP “BodyTag” interface.

This article is about creating custom Tag in JSP using “Tag” interface.
Creating custom tag in JSP has its unique advantages. This is same as Custom controls of the ASP.Net.
By creating the Custom tag, we can resuse that tag every where in our application. Best example of custom tags are the Struts.

Types of Tag:
Tag without body:

<ct:showTime displayTime="false" />

Tag with body:

<ct:showTime displayTime="false" >
Current Time is :
</ct:showTime>

As ther are two types of tag, there are two way of creating them in JSP:

  • By implementing below interfaces:
    1. Tag
    2. BodyTag
  • Or by extending any of the two below class (provides default implementation of interfaces discussed above):
    1. TagSupport (internally implements Tag)
    2. BodyTagSupport (internally implements BodyTag)

In this article, I will use the interface approach, so that the beginners can get broader idea about how Tag library actually implemented.

How to Create Custom Tag in JSP
How to Create Custom Tag in JSP

Continue reading “How to Create JSP Custom Tag – using Tag interface or TagSupport”

Life cycle of JSP BodyTag interface

Author posted by Jitendra on Posted on under category Categories JSP and tagged as Tags with 3 Comments on Life cycle of JSP BodyTag interface

Life cycle of JSP BodyTag interface

Previous article was about the life cycle of “Tag” interface, in this article i am going to explain the life cycle of “BodyTag” interface.

The BodyTag interface extends IterationTag by defining additional methods that let a tag handler manipulate the content of evaluating its body.

Life cycle of IterationTag and BodyTag interface in JSP
Life cycle of IterationTag and BodyTag interface in JSP

Continue reading “Life cycle of JSP BodyTag interface”

Life cycle of JSP Tag interface

Author posted by Jitendra on Posted on under category Categories JSP and tagged as Tags with 3 Comments on Life cycle of JSP Tag interface

Life cycle of JSP Tag interface in Java

Tag interface:
The interface of a classic tag handler that does not want to manipulate its body. The Tag interface defines the basic protocol between a Tag handler and JSP page implementation class.

Properties:
The Tag interface specifies the setter and getter methods for the core pageContext and parent properties.

Methods:
There are two main actions: doStartTag and doEndTag. Once all appropriate properties have been initialized, the doStartTag and doEndTag methods can be invoked on the tag handler. Between these invocations, the tag handler is assumed to hold a state that must be preserved. After the doEndTag invocation, the tag handler is available for further invocations (and it is expected to have retained its properties).

Empty and Non-Empty Action:
If the TagLibraryDescriptor file indicates that the action must always have an empty action, by an entry of “empty”, then the doStartTag() method must return SKIP_BODY.
Otherwise, the doStartTag() method may return SKIP_BODY or EVAL_BODY_INCLUDE.

If SKIP_BODY is returned the body, if present, is not evaluated.
If EVAL_BODY_INCLUDE is returned, the body is evaluated and “passed through” to the current out.

Life Cycle:

Life Cycle of Tag Interface
Life Cycle of Tag Interface

Continue reading “Life cycle of JSP Tag interface”

Setup application to use JavaServer Pages Standard Tag Library(JSTL)

Author posted by Jitendra on Posted on under category Categories JSP and tagged as Tags , with Leave a comment on Setup application to use JavaServer Pages Standard Tag Library(JSTL)

Setup application to use JavaServer Pages Standard Tag Library(JSTL)

To check whether JSTL is supported by your web container or not, run below code in jsp page:

Simple Test for JSTL Support: ${1+1}
<c:out value="${1+1}" />

With taglib url as :

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

Or

<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

Continue reading “Setup application to use JavaServer Pages Standard Tag Library(JSTL)”

Step by Step DWR Application – Simple AJAX in JAVA

Author posted by Jitendra on Posted on under category Categories JSP, Servlet and tagged as Tags , , with 18 Comments on Step by Step DWR Application – Simple AJAX in JAVA

Step by Step DWR Application – Simple AJAX in JAVA

In this article, i am going to explain the step by step approach to create the DWR (Direct Web Remoting) application in JAVA.

DWR consists of two main parts:

  • A Java Servlet running on the server that processes requests and sends responses back to the browser.
  • JavaScript running in the browser that sends requests and can dynamically update the webpage.
How DWR works in Java
How DWR works in Java

Continue reading “Step by Step DWR Application – Simple AJAX in JAVA”

Servlet, Hibernate, jQuery and Ajax based google like chat

Servlet, Hibernate, jQuery and Ajax based google like chat with source code

Hi, In this article, my aim is to create an application which uses the concept of Hibernate in Servlet with Ajax support of Jquery.
Below figure can give you the idea of final look and feel of the complete application:

Servlet, Hibernate, jQuery and Ajax based google like chat
Servlet, Hibernate, jQuery and Ajax based google like chat

Continue reading “Servlet, Hibernate, jQuery and Ajax based google like chat”