Read XML Taglib and JSTL in JSP

samle.xml  <?xml version="1.0" encoding="ISO-8859-1"?>  <weather ver="2.0">    <loc id="INXX0096">      <dnam>New Delhi, India </dnam>      <tm>3:30 PM </tm>  ...
READ MORE - Read XML Taglib and JSTL in JSP

How to read XML file in java

books.xml <?xml version="1.0" encoding="iso-8859-1"?> <library>  <book>    <name>Head First Java, 2nd Edition</name>    <author>Kathy Sierra and Bert Bates</author>    <publication-date>09-Feb-2005</publication-date>  </book>  <book>  ...
READ MORE - How to read XML file in java

getElementsByTagName in javascript

<html> <head> <title>getElementsByTagName Javascript</title> <script> function getElementFtn() {  alert(document.getElementsByTagName("p").item(0).innerHTML) } </script> </head> <body> <p>this...
READ MORE - getElementsByTagName in javascript

Form parameter validation using javascript(username,password,email,number,alphanumeric))

UserName Password validation <html> <head> <title>Required Validation</title> <script> function validate() {   var vUser=trim(document.frm.sUser.value);   var vPwd=trim(document.frm.sPwd.value);   if(vUser=="")  ...
READ MORE - Form parameter validation using javascript(username,password,email,number,alphanumeric))

Enable Disable Radio button Text box in JavaScript

<html> <head> <title>Enable Disable Radio button Text box in javascript</title> </head> <script>  function chMd()  {   // initialize form with empty field   document.forms[0].sTextBox.disabled=false;  ...
READ MORE - Enable Disable Radio button Text box in JavaScript

Selecting all checkboxes using javascript

<html> <head> <title>JavaScript - Select All checkbox in form</title> <script> var fieldName='chkName'; function selectall(){   var i=document.frm.elements.length;   var e=document.frm.elements;   var name=new...
READ MORE - Selecting all checkboxes using javascript

Get Checkbox Value using javascript

<html> <head> <title>JavaScript select checkbox</title> <script> function selectCheckBox() {   var e= document.frm.elements.length;   var cnt=0;   for(cnt=0;cnt<e;cnt++)   {     if(document.frm.elements[cnt].name=="id"){  ...
READ MORE - Get Checkbox Value using javascript

More than one form in HTML page

<html> <head> <title>Use more than one form in html page</title> </head> <body> <form name="frm1" action="actionPage1.jsp"> <input type="text" name="txtName"> <input type="submit" name="goSubmit"...
READ MORE - More than one form in HTML page

Confirm function in Javascript

<html> <head> <title>Confirm javascript</title> <script>     function validate()     {       var confirmMessage="Are you sure to move Yahoo home page!";       if(confirm(confirmMessage)==false)  ...
READ MORE - Confirm function in Javascript

Calling href using JavaScript

<html> <head> <title>Calling JavaScript Href</title> <script> function callHref() {   alert("Function is called from Href"); } </script> </head> <body> <a href="javascript:callHref()">Calling...
READ MORE - Calling href using JavaScript

How to Submit a Form Using JavaScript

<html> <head> <title>Submit form using javascript</title> <script> function goSubmit() {   document.frm.submit(); } </script> </head> <body> <form name="frm">  <a href="javascript:goSubmit()">Submit...
READ MORE - How to Submit a Form Using JavaScript

How to get day month year in date

import java.util.Calendar; public class GetDate {     public static void main(String[] args) {         Calendar ca1 = Calendar.getInstance();         /// get day month year from set date    ...
READ MORE - How to get day month year in date

How to find Week of Year

import java.util.Calendar; public class WeekOfYear {     public static void main(String[] args) {         Calendar ca1 = Calendar.getInstance();         /*         set(int year,...
READ MORE - How to find Week of Year

How to get Day of Week in Month

import java.util.Calendar; public class DayOfWeekInMonth {     public static void main(String[] args) {         Calendar ca1 = Calendar.getInstance();         ca1.set(2009, 6, 22);    ...
READ MORE - How to get Day of Week in Month

How to Add or Subtract Date

import java.util.Calendar; public class AddDate { public static void main(String[] args) { Calendar ca1 = Calendar.getInstance(); ca1.set(2009,05,25); // Addition of date in java ca1.add(Calendar.DATE, 23); // Add 23...
READ MORE - How to Add or Subtract Date

find Week of Month in java

import java.util.Calendar; public class WeekOfMonth {     public static void main(String[] args) {         Calendar ca1 = Calendar.getInstance();         /*         set(int year,...
READ MORE - find Week of Month in java

find Day of Year in Java

import java.util.Calendar; public class DayOfYear {     public static void main(String[] args) {         Calendar ca1 = Calendar.getInstance();         /*         set(int year,...
READ MORE - find Day of Year in Java

How to Create file in Java

import java.io.File; import java.io.FileWriter; import java.io.BufferedWriter; public class JavaIOWriteFileExample {     public static void main(String[] args) {         File f=new File("c:\\createNewfile.txt");  ...
READ MORE - How to Create file in Java

SortedSet Example

import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; public class SortedSetExample {     public static void main(String[] args) {         SortedSet<String> ss=new TreeSet<String>();  ...
READ MORE - SortedSet Example

Remove elements from SortedMap

import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; public class SortedMapRemoveExample {     public static void main(String[] args) {        ...
READ MORE - Remove elements from SortedMap

Remove elements from SortedSet

import java.util.Iterator; import java.util.SortedSet; import java.util.TreeSet; public class SortedSetRemoveExample {     public static void main(String[] args) {         SortedSet<String> ss=new TreeSet<String>();  ...
READ MORE - Remove elements from SortedSet

Remove elements from Set

import java.util.Iterator; import java.util.Set; import java.util.TreeSet; public class SetRemoveExample {     public static void main(String[] args) {         Set<String> s=new TreeSet<String>();  ...
READ MORE - Remove elements from Set

Remove elements from Map

import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; public class MapRemoveExample {     public static void main(String[] args) {         Map<Object,String> mp=new HashMap<Object,...
READ MORE - Remove elements from Map

Remove Element from ArrayList

import java.util.ArrayList; public class RemoveArrayListElement {     public static void main(String[] args) {         ArrayList<String> arlist=new ArrayList<String>();         //<E>...
READ MORE - Remove Element from ArrayList

Remove elements from List

import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class ListRemoveExample {     public static void main(String[] args) {         List<String> ls=new ArrayList<String>();  ...
READ MORE - Remove elements from List

List Example in java

import java.util.Iterator; import java.util.List; import java.util.ArrayList; public class ListExample {     public static void main(String[] args) {         // List Example implement with ArrayList      ...
READ MORE - List Example in java

Greatest Common Divisor or GCD using Recursion in java

public class GCD { public static int gcd(int num1, int num2) { if(num2 == 0) { return num1; } else { return gcd(num2, num1%num2); } } } //main class import java.util.Scanner; public...
READ MORE - Greatest Common Divisor or GCD using Recursion in java

Recursive function for X to the power Y

public class Power { public static double power(double base, double basePow) { if(basePow==0) { return 1; } else if(basePow==1) { return base; } else if(basePow>1) ...
READ MORE - Recursive function for X to the power Y

Recursive Koch Snow Flakes in java

import java.awt.*; import javax.swing.*; public class recursiveKochSnowFlakes extends JApplet{ int level = 0; public void init(){ String levelStr = JOptionPane.showInputDialog("Enter the depth of recursion"); level = Integer.parseInt(levelStr); ...
READ MORE - Recursive Koch Snow Flakes in java

Program that will Determine the Person's Salutation and Current Age

public class Person { private String fName; private String lName; private String sex; private int year; private int month; private int day; public Person() { fName=""; lName=""; sex=""; ...
READ MORE - Program that will Determine the Person's Salutation and Current Age

Binary Search Using Recursion in java

public class binarySearch { public int binSearch(int[] arr, int fIndex, int lIndex,int search) { int middle = (fIndex + (lIndex - fIndex) / 2); if(fIndex<lIndex ){ if (search == arr[middle]){ return middle; } else if(search...
READ MORE - Binary Search Using Recursion in java

Recursive Linear Search in java

public class Linear_Search { public void linSearch2(int[] arr, int fIndex, int lIndex, int searchNum) { if(fIndex == lIndex) { System.out.print("-1"); } else { if(arr[fIndex] == searchNum) { System.out.print(fIndex); } else { linSearch2(arr,...
READ MORE - Recursive Linear Search in java

How to sort numbers in Bubble Sort

public class BubbleSort { public void bubbleSort(int[] arr){ for(int i=0; i<arr.length; i++){ for(int j=1; j<arr.length; j++){ if(arr[j]< arr[j-1] ){ int temp = arr[j]; arr[j] = arr[j-1]; ...
READ MORE - How to sort numbers in Bubble Sort

Reverse string Or Print String Backward using Recursion

public class StringBackward { public static void reverseString(String word, int size) { if(size==0) { return; } else { System.out.print(word.charAt(size-1)); reverseString(word,...
READ MORE - Reverse string Or Print String Backward using Recursion

How to Sort Numbers using Selection Sort

public class SelectionSort { public void SelectionSort(int[] arr){ for(int i=0; i<arr.length; i++) { for(int j=i+1; j<arr.length; j++) { if(arr[i] > arr[j] ) { int temp...
READ MORE - How to Sort Numbers using Selection Sort

Add Numbers inside an Array Using Recursion

public class Array { public static int array( int[] arr, int first, int last) { // int sum = 0; if(arr[first] == arr[last])/* must be if(first == last),but try this one too, study the code, it is interesting */ { ...
READ MORE - Add Numbers inside an Array Using Recursion

Add Numbers inside an Array using For Loop

import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the size of the input you want to enter: "); int size = input.nextInt(); ...
READ MORE - Add Numbers inside an Array using For Loop

print/draw Diamond Shape using Asterisk in java

public class Diamond { public String Diamond_Asterisk(int num) { if(num>0) { return "*-" + Diamond_Asterisk(num-1); } else { return "-"; } } public String Diamond_Asterisk2(int...
READ MORE - print/draw Diamond Shape using Asterisk in java

Print Different Asterisk Shapes in java

//main method public class Main{ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a number: "); int n = input.nextInt(); Asterisk1 access = new Asterisk1(); access.asterisk2(n); } } //java class public...
READ MORE - Print Different Asterisk Shapes in java

How to pass parameters on URL query string

...
READ MORE - How to pass parameters on URL query string

what is servlet context,page context and application context

...
READ MORE - what is servlet context,page context and application context

Error in JSP page for displaying elements of an array list

...
READ MORE - Error in JSP page for displaying elements of an array list

Check if user has clicked on submit button based on client/server side

...
READ MORE - Check if user has clicked on submit button based on client/server side

File uploading using JSP and Servlet

...
READ MORE - File uploading using JSP and Servlet

Filtering Responses

...
READ MORE - Filtering Responses

Sending value from one jsp page to another jsp page

...
READ MORE - Sending value from one jsp page to another jsp page

default size of a JSP?

...
READ MORE - default size of a JSP?

Process Simple Text Files As JSP

...
READ MORE - Process Simple Text Files As JSP

How to invoke a URL from a JSP page

...
READ MORE - How to invoke a URL from a JSP page

Login authentication using tomcat7

...
READ MORE - Login authentication using tomcat7

Java program to Read text File Line by Line

import java.io.*; class FileRead {  public static void main(String args[])   {   try{   // Open the file that is the first   // command line parameter   FileInputStream fstream = new FileInputStream("textfile.txt");  ...
READ MORE - Java program to Read text File Line by Line

Convert Integer List to int array

...
READ MORE - Convert Integer List to int array

HTTP Status 404 error in tomcat

...
READ MORE - HTTP Status 404 error in tomcat

Difference between start() and run() method?

...
READ MORE - Difference between start() and run() method?

How to invoke a URL from a JSP page

...
READ MORE - How to invoke a URL from a JSP page

How can i count the returned rows from a database ?

...
READ MORE - How can i count the returned rows from a database ?

total number of rows in ResultSet

...
READ MORE - total number of rows in ResultSet

How to find the number of rows in the resultset ?

...
READ MORE - How to find the number of rows in the resultset ?

Compare HashSet,TreeSet and ArrayList by Example

import java.util.*; import java.math.*; public class NoDupsTest {   /* ---- HashSet approach (list order not maintained) ---- */   public static void test_HashSet(ArrayList a_master)   {     ArrayList a = new ArrayList(a_master);...
READ MORE - Compare HashSet,TreeSet and ArrayList by Example

ArrayList without duplicates

...
READ MORE - ArrayList without duplicates

Simple console print statement demonstration

public class ConsolePrintApplet1 extends java.applet.Applet { public void init () { // Put code between this line //------------------------------------------ double x = 5.0; double y = 3.0; System.out.println ("x * y = " +...
READ MORE - Simple console print statement demonstration

How to install and Configure the Tomcat Server

...
READ MORE - How to install and Configure the Tomcat Server

How to open a .war file inside Netbean IDE?

...
READ MORE - How to open a .war file inside Netbean IDE?

How to change functionlatiy in web page

...
READ MORE - How to change functionlatiy in web page

How to use web service in J2ME application(MIDP)

...
READ MORE - How to use web service in J2ME application(MIDP)

how to add web cam in web page

...
READ MORE - how to add web cam in web page

How to Open Text or Word File on JButton Click in Java

...
READ MORE - How to Open Text or Word File on JButton Click in Java

Hashtable in java

// Demonstrate a Hashtable import java.util.*; class HTDemo { public static void main(String args[]) { Hashtable balance = new Hashtable(); Enumeration names; String str; double bal; balance.put("John Doe", new...
READ MORE - Hashtable in java

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|