Skip to main content

Posts

Showing posts from October, 2013

php tutorial for beginners Introduction to php scripts

Watch this on YouTube

php tutorial for beginners First php page

Watch this on YouTube

php tutorial for beginners Install php and server

Watch this on YouTube

php tutorial for beginners Introduction to php

Watch this on YouTube                       

creating a simple struts application

Struts is a java framework used to implement the MVC  architecture more effectively.  In this post i explain some simple steps to create a java web application using the struts framework. For this demonstration i use the Netbeans IDE. Here i am going to create a simple login validation web application. In the login page there are two fields, first one is the name field and second one is an email field. If user enter any improper contents for any of these fields then  display an error message on the same login page using struts framework. You have to follow the steps given bellow for creating this simple strut application by yourself. Step 1: Create a java web application with name " StrutDemo " and choose the Struts framework from the frameworks window on the netbeans ide and click finish. Now the IDE creates the project and a welcomeStruts.jsp page will appear on the editor window of the ide. The project hierarchy  is shown bellow. Step 2: Create the login.jsp

pass by reference in java

In java there is no pointer concepts. So pass by reference using pointer is not possible in java. In java pass by reference is achieved by passing objects as arguments. It is possible to pass objects as argument to a function in java. In this post i am going to explain how to pass an object as reference in java. Ads by Google For better understanding consider the code segment given bellow.  class TestClass { String msg; public TestClass(String msg) { this.msg = msg; } public boolean checkObject(TestClass obj) { if(obj.msg.equals(msg)) return true; else return false; } } public class ObjectPassing { public static void main(String args[]) { TestClass test1 = new TestClass("Apple"); TestClass test2 = new TestClass("Orange"); TestClass test3 = new TestClass("Apple"); Sys

constructor overloading in java

Like method overloading you can also overload a constructor in java. A constructor is a special purpose class member function for initializing the objects of a class.  A constructor is overloaded on the basis of the arguments or parameters available with it. Ads by Google Consider the following class. class ConstructorTest { int a,b; public ConstructorTest() { a = 10; b = 20; System.out.println("From the default constructor a = "+a+ " and b ="+b); } public ConstructorTest(int a,int b) { this.a = a; this.b = b; System.out.println("From the parameterised constructor a = "+a+ " and b ="+b); } } In this class you can see that there is two constructors present. One is with no arguments and other is with two integer parameters. The compiler will invoke the appropriate constructor when a compatible object initiali