Tuesday, October 19, 2010

Mysql workbench

MySQL workbench:

To download mysql work bench .Click here

Recently i got chance to work on database. and my assignment was to create database and ER diagram. And to complete this assignment, i used MySQL workbench.

About MySQL Workbench

MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench is available as a native GUI tool on Windows, Linux and OS X in different editions. See the following link for more information about the editions available.

If you are familier with other gui tools like MySQL query browser and mysql administrator, both features are available in workbench. Other is data modeling, there you can create ER diagram.
Three parts of MySQL workbench:

1) SQL development: You can run your database query. very similar to mysql query browser.

2) Data Modeling: You can create ER diagram.

3)Server: very similar to mysql administrator browser. You acan create backup and restore of your database script.

I installed on windows 7 and vista. It was creating problems in XP. Error was .netframework, i tried but did not complete it.

Thanks
Deepak

Saturday, September 25, 2010

Firbug

Firebug:

To download the firbug development tool:
http://getfirebug.com/

Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.

Features:
Inspect HTML and modify style and layout in real-time: After installing or adding plug-in of firebug, see at the bottom of, an icon image (a worm image), click here,
Use the most advanced JavaScript debugger available for any browser
Accurately analyze network usage and performance

Some very helpful shortcuts and commands when working with firebug. Thanks to Duvet-Dayez for creating this cheat sheet.

Firebug cheat sheet

Deepak

Thursday, September 23, 2010

Internationalization in GWT

In my last assignment, i got good assignments on GWT like internationalization, history implementation and maintenance of log.
They are easy, but while you are doing these thing first time specially in GWT,then it is not a simple nut.

So i would like to discuss internationalization here.

First create GWT project. (Here i am creating project name: UsePropertyScreen)

Create 2 interface and 2 properties file with same name like PropertConstant.java and PropertyMessage.java and property files with PropertyConstant.properties and PropertyMessage.properties.

Code for PropertConstant.java
package deepak;
import com.google.gwt.i18n.client.Constants;
public interface PropertConstant extends Constants {

String hello();
//Add more key values here
}

Code for PropertyMessage.java

package deepak;
import com.google.gwt.i18n.client.Messages;
public interface PropertyMessage extends Messages {

String alertMessage();
String alertParameter(String arg);
}

Now Make entries in .property file also. Please provide same key as you gave in java file. i.e function name in java =key value in properties

PropertyConstant.properties
hello=Hello Deepak

PropertyMessage.java
alertMessage=Hello deepak!, welcome
alertParameter= Hello {0}

So if you want to pass more parameter, define function with parameter and in property file use {0} for first parameter and {1} for second parameter etc

Now make samall change in UsePropertyScreen.gwt.xml.file

<inherits name="com.google.gwt.i18n.I18N">

<extend-property name="locale" values="PropertyMessage">

And now use these key value inside client side file. It can't be used server side files.

Screen.java
package deepak;

import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.gwtext.client.widgets.MessageBox;

public class UsePropertyScreen implements {
private final PropertyMessage message=GWT.create(PropertMessage.class);
private final PropertyConstant constant=GWT.create(PropertConstant.class);
public UsePropertyScreen(){
MessageBox.alert(constant.hello());
MessageBOx.alert(message.alertMessage());
MessageBOx.alert(message.alertParameter("Deepak Pandey"));

RootPanel.get().add(new Label(constant.hello()));

}

}

Now run this application.

YOu will get 3 alert,
First with : "Hello Deepak"
Second with : "Hello Deepak!, welcome"
Third with : Hello Deepak Pandey

By default it will take above files. But if you want to change propert file according to your language. Create property file in following manner:
PropertyMessage_hi.properties
and select Hindi language or use hi in url address. So you are able to identify.
and change in UsePropertyScreen.gwt.xml,
<extend-property name="locale" values="hi">

cheers!

Thursday, August 26, 2010

Google Web Toolkit: Jar not loaded

When a Google Web Toolkit (GWT) web application is deployed to Tomcat web server,
you may encounter a warning message as follows.
org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(<$webAppsFolder$>\WEB-INF\lib\gwt-user.jar) - jar not loaded.
See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class

This raises just because WebappClassLoader has loaded the servlet.jar already. The gwt-user.jar already contain the content of the servlet.jar file. Even though this message can be ignored, this warning message can be avoided just by replacing the gwt-user.jar file with gwt-servlet.jar (which comes with Google Web Toolkit (GWT) download).

gwt-servlet.jar has been created by removing the content of the servlet.jar from the gwt-user.jar, so this change will not have any impact on your project.

Friday, July 30, 2010

Rs symol

Hello friends,

Indian rupee had got its sign like $ etc. and i hope that currency will receive greater international recognition with the launch of a new symbol for the currency.


Following is the link from where you can download Foradian.ttf font.
http://blog.foradian.com/

After downloading,paste fordian.ttf into control panel-->Font folder.
Now select font Rupee foradian in your document.
And use (~) key just below the Esc key.

Image of symbol:



Feel proud to be an Indian.
"Sare jahan se achha Hindostan hamara"

Saturday, July 24, 2010

JExcel API

In my last assignment, i got requirment to write data into excel file.I got the solution JExcel API.I got solution in the form of JExcel.Today, i will try to demonstrate JExcel API.
JExcelApi allows developers to read Excel spreadsheets and to generate Excel spreadsheets dynamically.It also contains a mechanism which allows java applications to read in a spreadsheet, modify some cells and write out the new spreadsheet.

Download JExcelApi JAR files from

http://jexcelapi.sourceforge.net/

Benifit of this API is:
Any operating system which can run a Java virtual machine (i.e., not just Windows) can both process and deliver Excel

spreadsheets. Because it is Java, the API can be invoked from within a servlet, thus giving access to Excel spreadsheets over

internet and intranet web applications.

Demo Application:

imported packages are following:
import jxl.Workbook;
import jxl.format.Colour;
import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;


public ByteArrayOutputStream generateExcelReport() throws IOException, WriteException {
/* Stream containing excel data */
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();

/* Create Excel WorkBook and Sheet */
WritableWorkbook workBook = Workbook.createWorkbook(outputStream);

or writing data in to generated xls
//Workbook workbook = Workbook.getWorkbook(new File(“Deepak.xls”));
WritableSheet sheet = workBook.createSheet("Project List", 0);

/* Generates Headers Cells */
WritableFont headerFont = new WritableFont(WritableFont.TAHOMA, 12, WritableFont.BOLD);
WritableCellFormat headerCellFormat = new WritableCellFormat(headerFont);
headerCellFormat.setBackground(Colour.PALE_BLUE);
sheet.addCell(new Label(1, 1, "Project Id", headerCellFormat));
sheet.addCell(new Label(2, 1, "Project Name", headerCellFormat));

/* Generates Data Cells */
WritableFont dataFont = new WritableFont(WritableFont.TAHOMA, 12);
WritableCellFormat dataCellFormat = new WritableCellFormat(dataFont);

int currentRow = 2;
for (User user : getUsers()) {
sheet.addCell(new Label(1, currentRow, user.getLastName(),dataCellFormat));
sheet.addCell(new Label(2, currentRow, user.getFirstName(),dataCellFormat));
currentRow++;
}

/* Write & Close Excel WorkBook */
workBook.write();
workBook.close();

return outputStream;
}

public List getUsers() {

try{
Class.forName("com.mysql.jdbc.Driver");
Connection

con=DriverManager.getConnection("jdbc:mysql://localhost/pmsdatabase2?user=root&password=mysql");
PreparedStatement ps=con.prepareStatement("select project_code,project_name from project");
ResultSet rs=ps.executeQuery();
while(rs.next()){
users.add(new User(rs.getString(1),rs.getString(2)));
}

}catch(Exception e){
System.out.println("Coming here!!"+e);
}
return users;
}

COde for User.java:

class User{

private String firstName;
private String lastName;
//getter and setter of firstName and lastName
public User(){}

public User(String lastName,String firstName){
this.firstName=firstName;
this.lastName=lastName;

}

}

Call this method by using any servlet.
A complete document is available on sourceforge or other sites.

Thanks!
Deepak

Friday, June 25, 2010

Great day for Indians

Today, like many indians i feel proud because today Queen's Baton reaching India. Wow what a great day for me and all indians.It is exactly a 100 day countdown for the first ever Commonwealth Games being hosted by India.

India, which will be hosting the prestigious international sporting event in the national capital, received the baton from Pakistan. Queen's Baton Relay, which has traveled across the world after it was launched by Queen Elizabeth-II at Buckingham Palace in Oct 2009, arrived in Amritsar through the Wagah Border.

I also hope like others that this kind of events would heal the strained relationship between India and Pakistan as well as bolster the ties between all countreis.

Thursday, June 24, 2010

Short Introduction GWT (Google Web ToolKit)

GWT:

In last couple of months, i am working on GWT (Google Web ToolKit). I am not great fan of this techonology because i got too many problems.

It uses well-known Remote Procedure Call (RPC) principles implemented by a generic servlet (RemoteServiceServlet), which you can specialize for your own needs. You also can use JavaScript Object Notation (JSON) as the data interchange format for your HTTP messages sent with the GWT HTTPRequest class.
Way of creating the application.
1)One way just install GWTSDK and create application by using following command
webappcreator -out projectname packagename.projectname
It creates structure similar to web applciation.
src:
--packagename.projectname.gwt.xml(This file contains information about entry point and inherited modules)
--packagename.client
--projectname.java (By default this is entry class and it runs while we run this applciation.)
--GreetingServiceAsync.java ( An interface with methods)
--GreetingService.java ( An interface which extends RemoteService)
--packagename.server
--GreetingServiceImpl (extends RemoteServiceServlet implements GreetingService )
This class overrides the methods of GreetingService
war:
--WEB-INF (with classes, lib folders and web.xml (similar to normal j2ee web application))
--projectname.html and .css
--build.xml (for detais of build.xml read ANT in detail)

In next post,I would like to discuss these files in detail
Now import this project to eclipse workspace ,build required jar (all required jar --inside bin of GWT folder or parallel to webappcreator) and run as JAVA Application (Hosted Mode)

2) Second way install plugin for GWT on eclipse. You will get 3 icons. One blue button ('g' is written on it) and other with red ('G' is written)and etc
Now just click on blue button and you got screen where you write project name and package name. (Uncheck Google App Engine for Now)
You project hasbeen created. If you want to use extra jar ,then build them.Some extra folders are created like test and test classes ,shared etc. Rest similar to above.



Problem: Less control over the client-side code of your application because it’s eventually generated by the GWT compiler.GWT provides a compiler that translates the Java code on the client side into JavaScript and DHTML.So you can use only few JAVA API's (lan and util).

Personally i got these error:
1)When i create war file, i am not able to create it properly while in normal web application i can create easily. (according to me This error is not because of GWT, but little bit tough for me..:( ) I am still with this error.
2)On changing platforms (Windows to linux and vice-versa), some functions doesn't support. So it requires extra time.

Maybe i am new of this tecgonology that's why i am getting these problem or it has.
But it creates good application where i want to use AJAX. Much dynamic site and better look can be created using this techonology.

Jar Needed for it:
gwt-dev-windows.jar or gwt-dev-linux.jar: Programming tools including the compiler. The embedded Web browser provided by GWT is platform-dependent.
gwt-user.jar: The GWT runtime.
gwt-servlet.jar: The jar to deploy on your application server with the code generated by the GWT compiler. It contains the RemoteServiceServlet.

Any suggestion or solution of problem. Plz tell me.

Thanks!!

Saturday, June 19, 2010

A basic application for iBatis use

Last month i got chance to learn some new techonologies like GWT (Google Web ToolKit) and iBatis. Firstly i would like to demonstrate application on iBatis. In upcoming posts, i would cover GWT.

I found iBatis very useful because With Ibatis I find myself getting the Job done faster, I create any POJO any set of tables, and I link them, much flixability in that field, but little extra work, building Queries and managing Maps (Little time required here). I never worked or got chance to learn hibernate.So bit difficult for me to tell that which is much better.But anyway here i developed a small application which only tells you that how you can use iBatis in your projects.

Download iBatis.jar
http://ibatis.apache.org/javadownloads.html

iBatis:

Step1: create SQLMapConfig.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlMapConfig>
<settings useStatementNamespaces="true"/>
<transactionManager type="JDBC">
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/mhrddemo"/>
<property name="JDBC.Username" value="root"/>
<property name="JDBC.Password" value="mysql"/>
</dataSource>
</transactionManager>
<sqlMap resource="DataBean.xml"/>
</sqlMapConfig>

you can create property file and then use that values in this config file.

2)create another xml where you write query:
DataBean.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap
PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd">

<sqlMap namespace="Contact">
<!--- Showing all data of table -->



<!--- Showing all data of table -->
<select id="getAll" resultClass="ibdeep.DataBean">
select university_id,entity_type,entity_description from entity_type
</select>

<resultMap id="result" class="ibdeep.DataBean">
<result property="university_id" column="university_id"/>
<result property="entity_type" column="entity_type"/>
<result property="entity_description" column="entity_description"/>

</resultMap>
<select id="getById" resultMap="result">
select * from entity_type where entity_type=#entity_type#
</select>


</sqlMap>

3) create a java file which has getter and setter of table fields or properties.

package ibdeep;

class DataBean
{

private String university_id;

private String entity_type;

private String entity_description;

public DataBean(){

}

public DataBean(String university_id,String entity_type,String entity_description){

this.university_id=university_id;
this.entity_type=entity_type;
this.entity_description=entity_description;

}

public String getUniversity_id(){

return university_id;

}

public void setUniversity_id(String university_id){

this.university_id=university_id;

}

public String getEntity_type(){

return entity_type;

}

public void setEntity_type(String entity_type){

this.entity_type=entity_type;

}

public String getEntity_description(){

return entity_description;

}

public void setEntity_description(String entity_description){

this.entity_description=entity_description;

}

}

Step 4): Create another java file
package ibdeep;

import com.ibatis.common.resources.Resources;

import com.ibatis.db.sqlmap.SqlMap;

import com.ibatis.sqlmap.client.*;

import java.io.Reader;

public class SqlMapManager {
private static SqlMap sqlMap = null;
static SqlMapManager smm;

public static SqlMapClient getSqlMapClient() {
try {
Reader reader = Resources
.getResourceAsReader("ibdeep/SqlMapConfig.xml");
SqlMapClient sqlMapper = SqlMapClientBuilder
.buildSqlMapClient(reader);
reader.close();

return sqlMapper;
} catch (Exception e) {
System.out.println("Map Exception");
e.printStackTrace();
throw new RuntimeException(e.getMessage(), e);
}
}


public void setSqlMap(SqlMap sqlMap) {
SqlMapManager.sqlMap = sqlMap;
}


public static SqlMap getSqlMap() {
return sqlMap;
}
}

Step 5) create properties file.you can use it.You can pass these values directly

url=jdbc:mysql://localhost:3306/mhrddemo
login=root
password=mysql

Step 6) Finally create java file which uses

package ibdeep;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;
import java.io.*;
import java.sql.SQLException;
import java.util.*;

class IBatisExample
{
public static void main(String[] args)
throws IOException,SQLException{
Reader reader = Resources.getResourceAsReader("SqlMapConfig.xml");
SqlMapClient sqlMap =
SqlMapClientBuilder.buildSqlMapClient(reader);

//Output all contacts

System.out.println("All Contacts");
List<DataBean> contacts = (List<DataBean>)
sqlMap.queryForList("Contact.getAll",null);
DataBean contact = null;
for (DataBean c : contacts) {
System.out.print(" " + c.getUniversity_id());
System.out.print(" " + c.getEntity_type());
System.out.print(" " + c.getEntity_description());
contact = c;
System.out.println("");
}
}
}

I hope it is useful.

Thursday, April 22, 2010

A Simple Apllication with DWR:

A Simple Apllication with DWR:

DWR: Direct Web Remoting-Easy Ajax for java

Link for DWR tutorial and download is:
http://directwebremoting.org/dwr/index.html

I found it very useful for my project PMS(Project Management System).
That's why I would like to demonstrate a simple application.

Just create webproject and put dwr.jar into lib.

Make changes in web.xml:
"<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>"

create dwr.xml and put following entries
"<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 0.4//EN" "http://www.getahead.ltd.uk/dwr/dwr.dtd">

<dwr>
<allow>
<create creator="new" javascript="DwrDemo">
<param name="class" value="deep.DwrDemo"/>
</create>

</allow>
</dwr>"
value of class where you write your fuction which you want to call on any event.
and this javascript (Here DwrDemo) willbe created corresponding to that class.

Now we try to use it in a simple JSP page.
Add these lines in you JSP.

" <script type='text/javascript' src='dwr/engine.js'></script>
<script type='text/javascript' src='dwr/util.js'></script>
<!-- This JavaScript file is generated specifically for your application -->
<script type='text/javascript' src='dwr/interface/DwrDemo.js'></script>
<script type="text/javascript">

function demo() {
var name = DWRUtil.getValue("name");

DwrDemo.demo(name,function(val)
{
DWRUtil.setValue("first",val);
}
);
}
</script>

This javascript function calls demo() method which is inside DwrDemo method.
val is value which is returned by function demo().

<body>
<select id="name" name="name" onchange="demo();">
<option value="Deepak">Deepak</option>
<option value="Anil">Anil</option>
<option value="Akash">Akash</option>
<option value="Mayank">Mayank</option>
</select>

<input type="text" id="first"/>
</body> "

Class deep.DwrDemo is given below.
package deep;

public class DwrDemo {

public String demo(String name)
{
if(name.equals("Deepak"))
return "Hello "+name+" Pandey";
else
return "Hello "+name;
}

}

Now Run your application.

Tuesday, March 30, 2010

Project Management System

Hi,

Last time i wrote about Project Management System(PMS). URL for PMS is

http://pms.iitk.ernet.in/


Thanks!!
Deepak

Friday, March 19, 2010

Add Graphs by Using JFree Chart

Recently i want to add graphs in PMS application. There are too many ways to do this.One of them is JFree Chart.Steps for this are following..

Step1: Download Demo Application of JfreeChart demo and get library jar.

Step2: Add following lines in your code and import files which is required.

JFreeChart chart = ChartFactory.createPieChart("Pie Chart created by Deepak Pandey", pieDataset, true, true,true);
BufferedImage bi = chart.createBufferedImage(500, 500);
chart.setBackgroundPaint(new Color(173, 230, 163));
BufferedImage buf = chart.createBufferedImage(500, 500, null);
try {
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());
JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(buf);
param.setQuality(0.75f, true);
encoder.encode(buf, param);

} catch (Exception e) {
System.out.println("Exception in JSP"+e);
}

Step3: Run you application

You can create this chart on a frame.
Create JFrame Object. and then add JFreeChart object and make this JFrame Object visible.

More Information of this JFreeChart,access following link
http://www.jfree.org

Thanks!!!

Tuesday, March 2, 2010

Custom tag

1)Create a class which extends BodyTagSupport or implements Tag

package deep;

import javax.servlet.jsp.tagext.BodyTagSupport;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;


public class Deepak extends BodyTagSupport {



BodyContent bodyContent;


public int doStartTag() throws JspException {

return EVAL_BODY_TAG;
OR
return SKIP_BODY;

}

public void setBodyContent(BodyContent
bodyContent) {
this.bodyContent = bodyContent;
}

public int doAfterBody() throws JspException {

return EVAL_BODY_TAG;
OR
return SKIP_BODY;

}

public int doEndTag() throws JspException {

return EVAL_PAGE;
}
}
//If It returns SKIP_PAGE,then code after the tag will not be executed ,in case of EVAL_PAGE it willbe calculated
2)Create tld(For ex:deep.tld)

3)Edit your web.xml

4)Add line in your JSP page
<%@ taglib uri="/WEB-INF/tag/name.tld" prefix="n" %>

and use tag which you defined earlier


5)Run your application

These are the steps which involved in making custom tag.Any suggestion or correction,plz leave comment.

Thanks
Deepak

Sunday, February 7, 2010

Project Management System

This system(PMS) can be used to manage projects. This includes project creation, task allocation, daily task monitoring, Gantt charts, sharing of documents, messaging and report generation.
Features
Managing project: User can add projects,view project according to enable/disable,update its detail
Monitoring task: Add task under projects,update its status etc
Managing organization:
Add,View and edit organisation.Admin user will assign project to user for an organisation.
Gantt chart: User can analyze project status by using Graphical Interface.
Managing resource: Add Member for your project.
N-level user: Every level of user can add its subordinate user.
Document sharing: Upload/download document for projects.
Reporting on demand:Report generation according to project status,user,task etc
Security:Proper authentication etc
E-mail notification: When a user is added or he assign task etc, a notification mail hasbeen sent.This mail configuration is configurable.

We are still working for features,for good graphics desgin and more user friendly,more graphics. And i request you to everyone,plz give suggession for more correction.It is an open source project and anyone can use and customize acording to their needs.

URL for this application:
http://202.141.40.218/

Thanks
Deepak

Thursday, January 21, 2010

Validation using validator framework

Validation on a form using validation form

1)Create a new web application
2)Add struts capabilities
3)create new action,form and jsp
4)Add the following lines in Struts-config.xml

//This is for validator plug in
plug-in className="org.apache.struts.validator.ValidatorPlugIn">
set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>


and in action tag ,add (validate="true") also.

6)Edit validation.xml
?xml version="1.0" encoding="UTF-8"?>
!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd">

form-validation>
formset>
form name="loginform" >
field property="name" depends="required,minlength" >
arg0 key="err.name" />
arg1 key="${var:minlength}" name="minlength" resource="false" />
var>
var-name>minlength
var-value>3
/field>
field property="pass" depends="required" >
arg0 key="err.pass" />
/field>
/form>
/formset>
/form-validation>

7)Edit Form JSP

html:javascript formName="loginform"/>
html:form action="login" onsubmit="return validateLoginform(this)">

onsubmit return validateFormName(this).

8)Test your application

Thanks
deepak

Thursday, January 14, 2010

Use Tiles in your Struts Application

Application Using Tiles:

For Eclise:
1) Create New Web-Project
2)Add Struts Capabilities.
3)Create "layout.jsp"
Use this Syntax:
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

tiles:insert attribute="header"/>
How you want to show your page.Like header,footer,main,left,body etc.Specify it here.

4)Make following Entry in "tiles-defs.xml"

tiles-definitions>
-- Base Tiles Definition
This is the main definition.You extend it in other definition.
It means if you can use same jsp or override it.
-->
definition name="base.definition" path="/Layout.jsp">
put name="header" value="/WEB-INF/JSP/header.jsp" />
put name="left" value="/WEB-INF/JSP/LeftLink.jsp"/>
put name="left" value="/WEB-INF/JSP/welcome.jsp"/>
put name="footer" value="/WEB-INF/JSP/footer.jsp" />


-- Tiles Definition of welcome page -->
definition name="page.welcome" extends="base.definition">
put name="title" value="Welcome page" />
put name="body" value="/WEB-INF/JSP/welcome.jsp" />




5)Edit Struts-Config.XML

Required part:
plug-in className="org.apache.struts.tiles.TilesPlugin">
set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
set-property property="moduleAware" value="true" />
set-property property="definitions-parser-validate" value="true" />


And define your actions as you want.
path="/welcome.do"
redirect="true" />

action-mappings>
action path="/welcome"
type="home.WelcomeAction">
forward name="showWelcome" path="page.welcome" />


action path="/leftlink"
type="home.LinkAction">
forward name="showLink" path="page.left" />



6)Create jsp according to your view and URL which you are giving in tiles-defs package

7)Create your actions.

8)Run your application.

I think it is useful.If any required step is still remaining,plz correct it.

Thanks
Deepak