Powered by Blogger.

Importance of toString() in java

>> Saturday, October 20, 2012

Object to String using toString method_JavabynataraJ
Object class of Java is having predefined toString() method. This method by default Object class calls implicitly when an object created. Overriding toString manually is nothing but implementing this method in our class.The java toString() method is used when we need a string representation of an object. It is defined in Object class.

The toString() method is useful for debugging. By default, when an object is printed out in a print stream like System.out, the toString() method of the object is automatically called.
While develping the code the developers used to check the object properties are getting through the object or not. For this print statement will be useful to quick test in the console.

public String toString()
Returns: a string representation of the object.
Let us take a Person class and try to print the person object using the System.out.println() statement.

How to sort an ArrayList

>> Tuesday, October 2, 2012

Sorting any ArrayList is pretty simple. Using Collections.sort( ) method we can sort the ArrayList. Collections class having all the static methods, we can use those methods directly along with the class name. These methods return the object as type Collection.

The important methods to synchronize the List, Set and Map as

synchronizedList(List<T> list)
synchronizedSet(Set<T> s)
synchronizedMap(Map<K,V> m) 

A simple program to sort an ArrayList

Starting Struts2 by Ian Roughley eBook Download

>> Sunday, September 30, 2012

Struts2 is the latest manifestation of the popular Struts Java web application framework. Like its predecessor, its goals are to make web application development faster, easier and more productive than ever before. Despite new languages and new techniques, the action-base MVC framework is still a viable and effective option for modern web application development.

Within this book you will find everything you need to get up and running using Struts2 - from the architecture and configuration, to implementing actions and the supporting infrastructure such as validation and internationalization.

The concepts covered by this book:
  • WHERE STRUTS2 FITS INTO THE WEB PARADIGM
  • CORE COMPONENTS
  • ARCHITECTURAL GOALS
  • PRODUCTIVITY TIPS
  • INTEGRATING WITH OTHER TECHNOLOGIES

Configure Tomcat in MyEclipse 9.1

>> Sunday, September 16, 2012

Once the Tomcat 6.0 installation is done in your local system, configure it in MyEclipse IDE.
Follow the below steps to configure Tomcat 6.0 in your MyEclipse.
Step1: Go to MyEclipse menu bar and select Window menu from there select preferences.

Installing and Configuring Tomcat 6.0

>> Sunday, September 9, 2012

Apache Tomcat is an open source software implementation of the Java, Servlet and JavaServer Pages technologies.We can use this to run our Java,Jsp and Servlet based web applications.We can deploy and monitor our application in this.

Double click on apache-tomcat-6.0.14.exe file.A prompt shows in windows 7 to accept installation.Before installing the tomcat you close all other applications.This will make it possible to update relevant system files without having to reboot your computer.

 Step 1: A Welcome Setup wizard displays after double clicking setup file. Click on Next button.

How to configure Java in MyEclipse 9.1

>> Wednesday, August 29, 2012

Configure java1.5 on MyEclipse_JavabynataraJ
To run java using MyEclipse 9.1 we should configure this. MyEclipse having more features to develop projects and this will be very useful for developers. This is the next generation of the MyEclipse Enterprise Workbench IDE for enterprise Java and web developers. Basically it supports Java EE 6.0 features such as:
  • Servlet 3.0
  • JSF 2.0
  • JPA 2.0
  • EJB 3.1
  • JAX-RS 1.1
MyEclipse having some Struts 2 Enhancements
  • Improved connection routing
  • Better undo/redo suport
  • Struts 2 specific validation for Struts 2 configuration files
Install MyEclipse in you System.

Display Current Date using GenericServlet

>> Sunday, August 26, 2012

We have a class named Date from java.util.Date package. We can use the Date class methods to display the date. We are going to display this date in the webpage using servlets.

Here we are using init methods to initialize the names and values. with this we can get the names and values from the web.xml file while the program runs. Actually this init(javax.servlet.ServletConfig) method is invoked by the container during initialization phase of the servlet interface.

init() method is a convienience method provided in javax.servlet.GenericServlet class. Generally, it is suggested that init(javax.servlet.ServletConfig) method present in javax.servlet.GenericServlet class should be given a chance to get executed, during servlet's initialization. This method, apart from performing some initialization process, invokes init() method at the end.

How to Copy properties from one Bean OtherBean

>> Saturday, August 4, 2012

As we know the Bean class containing the variables with setters and getters methods. We can access through the getXxx and setXxx methods by different properties. To copy the properties form one bean to another they should have same datatypes.

To Run our program the requirements are:

As per shown in the below image you can create the files in Eclipse.

How to Iterate Generic type of ArrayList

>> Sunday, June 10, 2012

Generics in Java
Generics were introduced in Java 1.5 to define abstract types for the variables of by enclosing a comma-separated list of their names within angle brackets after the name of the class or interface. We can user this type of variables any where in the class if a type is required in any instance fields or methods of the class.

Now in this post we are learning how to iterate the Generic type of list.

Normally we used to iterate any list we take the help of Iterator. If it is normal list as well we can iterate the Generic type.

Lets take a bean class of User with a constructor and setters and getters methods.

Here the User having the String type name and link variables.

How to Reverse a String (Sentence) in Java

>> Sunday, April 22, 2012

Reverse a String the form of words we are taking the help of StringTokenizer class it is having six featured methods in its class. We can use two of them. First apply StringTokenizer on the String then Split the sentence to words using delimiter. Then push all the words into Stack class. At last pop all words from Stack.

We can form a reverse sentence in this easy way as show below diagram.

Beginning JavaServer Pages Download

>> Friday, March 16, 2012

Beginning JavaServer Pages
JSP is one of the core technologies for server-side Java applications and the 2.0 release, which this book covers in detail, makes JSP an even more powerful tool.Walks Java programmers and Web developers through JSP fundamentals, including JSP syntax and directives, JSP Expression Language, JSP Tag libraries, JSTL, and techniques for testing and debugging.

Shows how to use JSP in real-world Web applications along with open source frameworks such as Struts, WebWork, and Turbine, software design methodologies, and developer tools like Ant, jUnit, and CVS, as well as popular IDEs (integrated development environmnents).Each chapter has an exercise section with solutions on the companion Web site.

Sams Teach Yourself JavaServer Pages 2.0 with Apache Tomcat in 24 Hours, Complete Starter Kit

Sams Teach Yourself JavaServer Pages 2.0 with Apache Tomcat
In JavaServer Pages 2.0, Sun has added new features that make it even easier to create dynamic, interactive Web pages in Java. These include a built-in expression language and a library of tags (the JSP Standard Tag Library) that facilitate creation of pages.

Sams Teach Yourself JavaServer Pages 2.0 in 24 Hours starts with the basics of JSP, and explains the expression language, JSTL, creating new tags and more. Each lesson builds on the previous one, giving you a full picture of JSP development. Later chapters describe how to incorporate XML, interface with larger Java applications, work with popular frameworks such as Struts, and more. The book includes Apache Tomcat, Sun's reference implementation of JSP, so you can start developing applications immediately.

Java for the Web with Servlets, JSP and EJB pdf download

>> Tuesday, March 6, 2012


Java for the Web with Servlets, JSP, and EJBJava for Web with Servlets, JSP and EJB is the one book you need to master Java web programming. It covers all the technologies needed to program web applications in Java using Servlets 2.3, JSP 1.2, EJB 2.0 and client-side programming with JavaScript. These technologies are explained in the context of real-world projects, such as an e-commerce application, a document management program, file upload and programmable file download, and an XML-based online book project.

In addition to excellent content, this book includes licenses to two Java web components from BrainySoftware.com. You receive a full license of the Programmable File Download component for commercial and non-commercial deployment. 

You are also granted to a license to deploy the author's popular File Upload bean for non-commercial use, which has been licensed by the Fortune 500 company Commerce One and purchased by major corporations such as Saudi Business Machine, Ltd. and Baxter Healthcare Corporation.

more Servlets and JavaServer Pages eBook Download

>> Saturday, March 3, 2012

more Servlets and JavaServer Pages
Marty Hall's Core Servlets and JavaServer Pages was last year's #1 servlet/JSP book helping over 100,000 Java developers master the power of Java server-side programming to Web-enable an extraordinary range of applications. Now, Hall takes the next step, bringing together even more powerful servlet/JSP techniques.

After a quick review of the basics, Hall presents in-depth coverage of the latest servlet and JSP capabilities incorporated in JDK Version 1.4, including filters, application events, and enhancements to JSP's XML support. Next, Hall moves on to Web application development, introducing the latest Servlet 2.3/JSP 1.1 features, and offering in-depth coverage of the Web Application Deployment Descriptor.

Head-First core Java-2nd Edition Download

>> Thursday, March 1, 2012

Head-First core Java-2nd Edition DownloadLearning a complex new language is no easy task especially when it s an object-oriented computer programming language like Java. You might think the problem is your brain. It seems to have a mind of its own, a mind that doesn't always want to take in the dry, technical stuff you're forced to study. 

The fact is your brain craves novelty. It's constantly searching, scanning, waiting for something unusual to happen. After all, that's the way it was built to help you stay alive. It takes all the routine, ordinary, dull stuff and filters it to the background so it won't interfere with your brain's real work--recording things that matter. How does your brain know what matters? It's like the creators of the Head First approach say, suppose you're out for a hike and a tiger jumps in front of you, what happens in your brain? Neurons fire. Emotions crank up. Chemicals surge. 

Data Structures with Java, Second Edition by JohnR.Hubrand

>> Monday, February 27, 2012

Data Structures with Java
Scores of problems and examples—which will be available on the Internet after publication—simplify and demonstrate central concepts and help users develop their expertise in handling data structures in Java .
• Java is today’s fastest growing programming language, with broad popular appeal for its ease of use in creating websites and its functioning capability on any platform 
• Topics cover all the material in the first- or second-year course required of all Computer Science majors

From the Back Cover
Master the fundamentals of data structures with Java with Schaum’s—the high-performance study guide. It will help you cut study time, hone problem-solving skills, and achieve your personal best on exams and projects!
Students love Schaum’s Outlines because they produce results. Each year, hundreds of thousands of students improve their test scores and final grades with these indispensable study guides.

SCWCD Exam Study Kit Second Edition eBook Download

SCWCD Exam Study Kit Second Edition
Aimed at helping Java developers, Servlet/JSP developers, and J2EE developers pass the Sun Certified Web Component Developer Exam (SCWCD 310-081), this study guide covers all aspects of the Servlet and JSP technology that Sun has determined necessary. This new edition adds aspects of servlet/JSP development, such as the Expression language, and updated materials of servlets with a particular focus on using filters to make request processing more efficient.

Covering the reliance on the JSP Standard Template Library (JSTL) and its core, this guide allows JSP developers will be able to simplify their development process and remove Java-based scriptlets and expressions from their code. All applications in this book are designed to run on Apache's latest development server, Tomcat 5.0, and instructions on how to install this new edition and execute servlets and JSPs are included.

Java Pocket Guide by Patricia and Robert

>> Sunday, February 19, 2012

Java Pocket Guide by Patricia and Robert
How many times have you reached an impasse while writing code because you couldn't remember how something in Java worked? This new pocket guide is designed to keep you moving. Concise, convenient and easy to use, the Java Pocket Guide gives you Java stripped down to its bare essentials in fact, it's the only book on Java that you can actually fit in your pocket.

Written by Robert and Patricia Liguori, senior software and lead information engineers for Java-based air traffic management and simulation environments, Java Pocket Guide contains everything you really need to know about Java, particularly everything you need to remember.

The book pays special attention to the new areas in Java 5 and 6, such as generics and annotations.

Effective Java (2nd Edition) Programming Language

>> Friday, February 17, 2012

 Effective Java™, Second Edition
Are you looking for a deeper understanding of the Java™ programming language so that you can write code that is clearer, more correct, more robust, and more reusable? Look no further! Effective Java™, Second Edition, brings together seventy-eight indispensable programmer’s rules of thumb: working, best-practice solutions for the programming challenges you encounter every day.

This highly anticipated new edition of the classic, Jolt Award-winning work has been thoroughly updated to cover Java SE 5 and Java SE 6 features introduced since the first edition. Bloch explores new design patterns and language idioms, showing you how to make the most of features ranging from generics to enums, annotations to autoboxing.

Beginning Java SE 6 platform from novice to professional

Beginning Java SE 6
Beginning Java™ SE 6 Platform: From Novice to Professional steers you through the maze of Java Standard Edition (SE) 6 features. The first chapter sets the stage by introducing Java SE 6 in terms of its name change, themes, an overview, and a sampling of new features. It also briefly discusses the first two Java SE 6 updates.

The remaining nine chapters organize features into the following categories: core libraries, GUI toolkits: AWT, GUI toolkits: Swing, internationalization, Java Database Connectivity, monitoring and management, networking, scripting, and security and web services. While exploring these chapters, you will encounter a variety of useful and interesting topics: introducing a new locale with its own currency, creating a new JConsole plug–in, creating a scripted JEditorPane component, invoking and communicating with JavaFX Script and JRuby scripts from a Java application that interacts with the Scripting API, signing an arbitrary XML document and validating a signed document’s XML signature, and accessing an existing web service are examples.

Core Java, Vol. 2: Advanced Features, 8th Edition

>> Tuesday, February 14, 2012

Core Java, Vol. 2: Advanced Features, 8th EditionThe revised edition of the classic Core Java™, Volume II–Advanced Features, covers advanced user-interface programming and the enterprise features of the Java SE 6 platform. Like Volume I (which covers the core language and library features), this volume has been updated for Java SE 6 and new coverage is highlighted throughout. All sample programs have been carefully crafted to illustrate the latest programming techniques, displaying best-practices solutions to the types of real-world problems professional developers encounter.

Volume II includes new sections on the StAX API, JDBC 4, compiler API, scripting framework, splash screen and tray APIs, and many other Java SE 6 enhancements.

Core Java™, Volume I-Fundamentals (8th Edition)

>> Sunday, February 12, 2012

Core Java™, Volume I-Fundamentals
This revised edition of the classic Core Java™, Volume I–Fundamentals, is the definitive guide to Java for serious programmers who want to put Java to work on real projects.

Fully updated for the new Java SE 6 platform, this no-nonsense tutorial and reliable reference illuminates the most important language and library features with thoroughly tested real-world examples. The example programs have been carefully crafted to be easy to understand as well as useful in practice, so you can rely on them as an outstanding starting point for your own code.


Throwing javaw.exe error path while starting Eclipse

A Java Runtime Environment(JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine wes found after searching the following locations:


E:\SoftWares\Eclipse\ECLIPSE_GANYMEDE\eclipse-jee-ganymede-SR2-win32\eclipse\jre\bin\javaw.exe
javaw.exe in your current PATH


Java The Complete Reference 7th Edition Download

>> Monday, January 30, 2012


The world's leading programming author offers comprehensive coverage of the new Java release

The definitive guide to Java has been fully expanded to cover every aspect of Java SE 6, the latest version of the worldAnd#39;s most popular Web programming language. This comprehensive resource contains everything you need to develop, compile, debug, and run Java applications and applets.

The Definitive Guide for Java Programmers

In this comprehensive resource, top-selling programming author Herbert Schildt shows you everything you need to develop, compile, debug, and run Java programs. This expert guide has been updated for Java Platform Standard Edition 6 (Java SE 6) and offers complete coverage of the Java language, its syntax, keywords, and fundamental programming principles.

Download Java 2 Core Language Little Black Book

>> Sunday, January 29, 2012

The focus of this book is on the core Java language as implemented by the new version of Java, version 1.4. The book features a logical, sequential approach with concise overviews, then step-by-step immediate solutions created by a master Java programmer. This book is also packed with over 150 code listings which can be used as is or quickly modified.


  • Paperback: 440 pages
  • Publisher: Paraglyph Press; 1 edition (August 2002)
  • Language: English


Download Object Oriented Programming with Java eBook

>> Saturday, January 28, 2012


Object Oriented Programming with Java eBook_JavabynataraJ
An Introduction to Object-Oriented Programming with Java takes a full-immersion approach to object-oriented programming. Proper object-oriented design practices are emphasized throughout the book. Students learn how to use the standard classes first, then learn to design their own classes.

Wu uses a gentler approach to teaching students how to design their own classes, separating the coverage into two chapters. GUI coverage is also located independently in the back of the book and can be covered if desired.

Wu also features a robust set of instructors' materials including PowerPoint slides, code samples, and quiz questions.

Static ContextPath to Dynamic ContextPaths in Jsp and JS pages.

>> Thursday, January 26, 2012

Changing Static ContextPath to Dynamic ContextPath references in JSP and JS pages in our project. If you are working with any project on java and jsp technologies, if the requirement may come to change the static context paths to dynamic context path.

What is the need to change context path from static to dynamic context path?

While developing our application we use to develop to put our contextPath directly in some areas like for links and mostly for images we give absolute paths with context. We put this in developing the project. After developing the project , it goes to Testing after then to production.
Let us assume our project contextPath is "/myproj"

Understanding foreach loop in Java

>> Sunday, January 8, 2012


To make iteration over arrays and other collections more convenient Java5 extended the basic for loop and it is named as for-each Loop and also called as enhanced for loop or foreach loop.

The for-each loop is used to access each successive value in a collection of values.

This foreach loop is commonly used to iterate over an array or a Collections class (eg, ArrayList).

Related Posts Plugin for WordPress, Blogger...
© javabynataraj.blogspot.com from 2009 - 2022. All rights reserved.