Wednesday 25 November 2015

About Java 8

Java SE 8 (March 18, 2014)
Java 8 was released on 18 March 2014, and included some features that were planned for Java 7 but later deferred.
Work on features was organized in terms of JDK Enhancement Proposals (JEPs).

·         JSR 335, JEP 126: Language-level support for lambda expressions (officially, lambda expressions; unofficially, closures) under Project Lambda and default methods (virtual extension methods)]which make multiple inheritance possible in Java. There was an ongoing debate in the Java community on whether to add support for lambda expressions. Sun later declared that lambda expressions would be included in Java and asked for community input to refine the feature.]Supporting lambda expressions also allows the performance of functional-style operations on streams of elements, such as MapReduce-inspired transformations on collections. Default methods allow an author of API to add new methods to an interface without breaking the old code using it. It also provides a way to use multiple inheritance, multiple inheritance of implementation more precisely.
·         JSR 223, JEP 174: Project Nashorn, a JavaScript runtime which allows developers to embed JavaScript code within applications
·         JSR 308, JEP 104: Annotation on Java Types
·         Unsigned Integer Arithmetic[
·         JSR 337, JEP 120: Repeating annotations[
·         JSR 310, JEP 150: Date and Time API
·         JEP 178: Statically-linked JNI libraries
·         JEP 153: Launch JavaFX applications (direct launching of JavaFX application JARs)]
·         JEP 122: Remove the permanent generation
·         Java 8 is not supported on Windows XPbut as of JDK 8 update 25, it can still be installed and run under Windows XP.[192] Previous updates of JDK 8 could be run under XP, but had to be installed after a forced installation by directly unzipping files from the installation executable.
From October 2014, Java 8 has been the default version to download from the official website
.Java 8 updatesRelease
Release date
Highlights
Java SE 8
2014-03-18
Initial release
Java SE 8 Update 5
2014-04-15
Using "*" in Caller-Allowable-Codebase attribute; bug fixes
Java SE 8 Update 11
2014-07-15
Java Dependency Analysis Tool (jdeps); Java Control Panel option to disable sponsors; JAR file attribute – Entry-Point; JAXP processing limit property – maxElementDepth; 18 security bug fixes
Java SE 8 Update 20
2014-08-19
Java SE 8 Update 25
2014-10-14
Java SE 8 Update 31
2015-01-19
26 bug fixes. SSLv3 disabled by default.
Java SE 8 Update 40
2015-03-03
Added the notion of "memory pressure" to help indicate how much of system's memory is still available (low pressure = high memory, high pressure = low memory).
Java SE 8 Update 45
2015-04-14
Java SE 8 Update 51
2015-07-14
Added support for native sandbox on Windows platforms. This feature is disabled by default. Also, 25 security fixes.
Java SE 8 Update 60
2015-08-18
480 bug fixes
Java SE 8 Update 65
2015-10-20
3 bug fixes
Java SE 8 Update 66
2015-11-16
15 bug fixes
Java SE 9
At JavaOne 2011, Oracle discussed features they hope to have in the initial release of Java 9 scheduled for 22 September 2016, including better support for multi-gigabyte heaps, better native code integration, and a self-tuning JVM.
·         JSR 294: Modularization of the JDK under Project Jigsaw (Java Module System)
·         JSR 354: Money and Currency API
·         JEP 222: jshell: The Java Shell (a Java REPL)[
There are plans to add automatic parallelization using OpenCL
Java SE 10
There is speculation of introducing objects without identity (value types), as well as moving towards 64-bit addressable arrays to support large data sets somewhere around 2018.


Friday 20 November 2015

ALL THE BEST

TODAY  I   FEEL VERY HAPPY..

WISH  U ALL THE BEST MY DEAR STUDENT

Wednesday 11 November 2015

JAVA WITH MS ACCESS -Simple way learn front -end and back-end connection


import java.lang.*;
import java.sql.*;
import java.util.*;
import java.io.*;
class jdbcconnection1
{
public static void main(String args[])throws IOException
{
try
{
Connection con;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:ds1");
Statement s=con.createStatement();
ResultSet rs=s.executeQuery("select *from tele1");
while(rs.next())
{
System.out.println("Rollno:"+rs.getString(1));
System.out.println("mark:"+rs.getString(2));
}
con.close();
s.close();
}
catch(Exception e){}
}
}

Friday 6 November 2015

Simple way to learn JSP AND AJAX

ONMOUSEOVER EVENT
EX.NO :    10
DATE      :   
AIM:
To write a java script code to count number of times you move over a link or record.
HARDWARE REQUIREMENTS       
   1. Computer with Pentium processor.
SOFTWARE REQUIREMENTS:
  1. Notepad or any Editor
  2. Internet Explorer Web Browser           
PROCEDURE:
1.   Open the Notepad
2.   Type the Html code and java script code in Notepad
3.   Save the file with the extension.html or .htm
4.   Run the Html document in any Web browser
5.   Verify the output
HTML CODE & JAVA SCRIPT CODE:
mouse.html  
<html>
<head>
<title>New Page 1</title>
<script type=text/javascript>
count=0
function linkcount()
{
 count++
 lc.innerText=count
}
</script>
</head>
<body>
<a target="_self" href="red.html" onmouseover="linkcount()">Red</a>
<p>
<font face="Bodoni MT" color="#0000FF">
Number of times you moved over a link &gt;&gt;
 </font>
<font face="Bodoni MT" color=#FF0000 id=lc>
</font>
</p>
</body>
</html>
red.html
<html>
<head>
<title>New Page 1</title>
</head>
<body bgcolor=red>
<b><font color="#FFFFFF">Red
</font></b>
</body>
</html>
OUTPUT:










RESULT:
      Thus the web page for onmouseover event is designed, executed and the required output is obtained.
SENDING REQUEST TO JSP
EX.NO     :    11
DATE      :   
AIM:
     To write a HTML document which sends the user request for open source  item to JSP and gets the definition of open source item.
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Edit the HTML coding and save it with .html extension.
  3. Edit the JSP coding and save it with .jsp extension.
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
  5. Run the tomcat server using command prompt.
  6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
  7. Observe the output.
HTML AND JSP CODE:
Open_src.html
<html>
<head><title>Chemistry Item</title></head>
<body>
<form method=post action=item.jsp>
<p align="center">
Enter Your Open Source  Item :
<input type="text" name="t1" size="20">
<input type="submit" value="Send" name="B1">
<input type="reset" value="Clear" name="B2">
</p>
</form>
</body>
</html>
item.jsp
<%
String name[]={"Red Hat Linux ","PHP","PHYTHON","OSCAD","LATEX"};
String def[]={"Operating System", "Developing Interactive Website", "Numerical Computation Software for Science and Engg", "Software for Circuit Design” ,”Software for word processing and spread sheet“};
String s1=request.getParameter("t1");
String s2=s1.toUpperCase();
int i;
for(i=0;i<10;i++)
{
 if(s2.equals(name[i]))
 {
  out.print("THE DEFINITION FOR GIVEN ITEM -- >def[i]);
  break;
 }
}
OUTPUT:







RESULT:
      Thus the web page for Sending request to JSP Page is designed, executed and the required output is obtained.
COOKIE MANIPULATION
EX.NO     :    12
DATE      :
AIM:
     To write a JSP code to manipulate cookies.
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Edit the HTML coding and save it with .html extension.
  3. Edit the JSP coding and save it with .jsp extension.
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
  5. Run the tomcat server using command prompt.
  6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
  7. Observe the output.
HTML AND JSP CODE:
cookie.html
<html>
<head><title>Creating cookies</title></head>
<body bgcolor=wheat>
<form action=createcookie.jsp method=post>
<pre>
<center>COOKIE MANIPULATION</center>
Enter your Name              : <input type=text name=t1 id=t1>
Enter your Favourite Color   : <input type=text name=t2 id=t2>
</pre>
<input type=submit value=SEND>
<input type=reset value=CLEAR>
</form>
</body>
</html>

createcookie.jsp
<html>
<body bgcolor=wheat>
<%
String name=request.getParameter("t1");
String color=request.getParameter("t2");
Cookie added=null;
added=new Cookie(name,color);
response.addCookie(added);
%>
<a href="showcookie.jsp">Show Cookies</a>
</body>
</html>

showcookie.jsp
<%
Cookie cookies[]=request.getCookies();
for(int i=0;i<cookies.length;i++)
{
 out.print(cookies[i].getName()+"-"+cookies[i].getValue()+"<br>");
}
%>
RESULT:
     Thus the JSP page for cookies manipulation is designed, executed and the required output is obtained.
UPLOADING FILE
EX.NO     :    13
DATE      :
AIM:
     To write a JSP code to upload data from client side.
HARDWARE REQUIREMENTS:
1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
1. Notepad or any editor
2. Apache Tomcat Server 5.0
3. JDK 1.7
4. Internet Explorer
PROCEDURE:
1. Open the notepad or any notepad.
2. Edit the HTML coding and save it with .html extension.
3. Edit the JSP coding and save it with .jsp extension.
4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
5. Run the tomcat server using command prompt.
6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
7. Observe the output.
HTML AND JSP CODE:
upload.html
<html>
<head>
<title>New Page 1</title>
</head>
<body bgcolor=olive>
<h1><center>Uploading File....</center></h1>
<form method="POST" action="up.jsp">
<p><input type="file" name="filename" size="20"></p>
<p><input type="submit" value="Upload" name="B1">
<input type="reset" value="Reset" name="B2"></p>
</form>
</body></html>

up.jsp
<<%@ page import="java.util.*,java.io.*" %>
<%
String path=request.getParameter("filename");
String newpath="";
int count=0;
if(path!=null)
{
 ArrayList arr=new ArrayList();
 StringTokenizer st=new StringTokenizer(path,"\\");
 while(st.hasMoreTokens())
 {
  arr.add(count,st.nextToken());
  count++;
 }
 newpath="c:/upload/"+arr.get(count-1);
 int c;
 FileInputStream fis=new FileInputStream(path);
 FileOutputStream fos=new FileOutputStream(newpath);
 while((c=fis.read())!=-1)
 {
  fos.write((char)c);
 }
 out.print("File Uploadad from : "+path+"<br>");
 out.print("Uploaded file saved in : "+newpath);
}
%>

RESULT:
     Thus the JSP page for uploading file is designed, executed and the required output is obtained.
IMAGE MAP
EX.NO     :    14
DATE      :
AIM:
     To write a JSP application using image map to give information about the institution
HARDWARE REQUIREMENTS:
1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
1. Notepad or any editor
2. Apache Tomcat Server 5.0
3. JDK 1.7
4. Internet Explorer
PROCEDURE:
1. Open the notepad or any notepad.
2. Edit the HTML coding and save it with .html extension.
3. Edit the JSP coding and save it with .jsp extension.
4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
5. Run the tomcat server using command prompt.
6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
7. Observe the output.
HTML AND JSP CODE:
EXNO14.html
<html>
  <body>
       <a href="http://localhost:8084/WebApplication2/exno14.jsp">
       <img name="map" src="                                " ismap>
       </a>
  </body>
</html>

exno14.jsp
<html>
    <body>
        <%
     String coord = request.getQueryString();
     int comma_pos = coord.indexOf(",");
     int x = Integer.parseInt(coord.substring(0, comma_pos));
     int y = Integer.parseInt(coord.substring(comma_pos+1));
     if ( x > y )
    out.print("The Right region of Institute contains : ECE, EEE, ITI and Boys Hostel Blocks");
     else
    out.print("The Middle region of Institute contains : Main Block I and II, Computer and Girls  Hostel Blocks");
    %>
    </body>
</html>













RESULT:
     Thus the JSP application for image map is designed, executed and the required output is obtained.
HIT COUNTER
EX.NO     :    15
DATE      :
AIM:
     To write a JSP code to check how many users have visited a website using application object.
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Edit the HTML coding and save it with .html extension.
  3. Edit the JSP coding and save it with .jsp extension.
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
  5. Run the tomcat server using command prompt.
  6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
  7. Observe the output.
JSP CODE:
visit.jsp
<html>
<body>
<%
  //session object
  Integer scount=(Integer)session.getAttribute("scount");
 if(scount==null)
 {
   scount=new Integer(1);
 }
else
{
scount= new Integer(scount.intValue()+1);
}
session.setAttribute("scount",scount);
//application object
Integer acount=(Integer)application.getAttribute("acount");
 if(acount==null)
 {
   acount=new Integer(1);
 }
else
{
acount= new Integer(acount.intValue()+1);
}
application .setAttribute("acount",acount);
%>
<h1>your session ID is <%=session.getId()%><h1><br>
<h1> your have visited this page <%=scount%>times</h1><br>
<h1> This page has been visited  by  all  user <%= acount%>times</h1><br>
</body></html>
OUTPUT:






RESULT:
     Thus the JSP code Hit Counter  is designed, executed and the required output is obtained.

LOGIN PERMISSION
EX.NO     :    16
DATE      :
AIM:
     To write a JSP code to check whether a person will be permitted to open a particular page or not using permission checker component.
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Edit the HTML coding and save it with .html extension.
  3. Edit the JSP coding and save it with .jsp extension.
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address.
  5. Run the tomcat server using command prompt.
  6. Open the internet explorer. In address bar give  http://localhost:8080/ follows filename with extension to run.
  7. Observe the output.
HTML AND JSP CODE:
login.html
<html>
<head>
<title>
Login Page
</title>
</head>
<body>
<form action=log.jsp method=post>
<h1><center>Login Page</center></h1>
Username :<input type=text name=t1 id=t1><br>
Password :<input type=password name=t2 id=t2><br>
<input type=submit name=b1 value=LOGIN>
<input type=reset name=b2 value=CLEAR>
</form>
</body>
</html>

log.jsp
<html>
<head>
<title>Welcome</title>
</head>
<body>
<%
String user=request.getParameter("t1");
String pass=request.getParameter("t2");

if((user.equals("abc"))&&(pass.equals("computer")))
{
 out.print("You are an authorized user..!"+"<br>");
%>
 <a href=sample.html>Click here to open</a>
<%
}
else
{
 out.print("You are not an authorized user..!"+"<br>");
 out.print("Go back and Retype your username and password");
}
%>
</body>
</html>

sample.html
<html>
<head>
<title>
Login Page
</title>
</head>
<body>
          Sample Test Page …
</body>
</html>
OUTPUT:













RESULT:
     Thus the Login Permission JSP code is designed, executed and the required output is obtained.

Hello World Application using AJAX
EX.NO     :    17
DATE      :
AIM:
To Develop a Simple Hello World Application using
 AJAX
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Type Html and Javascript code to send client request and receive response from server
  3. Create text file and store it as .txt extension
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address
  5. Open the internet explorer. In address bar give  http://localhost:8084/ follows filename with extension to run.
  6. Observe the output.
HTML CODE:
Ajax1.html
<html>
  <head>
    <title>hell world application</title>
       <script>
function f1()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","sample.txt",true);
xmlhttp.send();
}
</script>

 <body>
<div id="myDiv"><h2>Ajax Welcome Application </h2></div>
<button type="button" onclick="f1()">Change Content</button>
  </body>
</html>


Sample.txt

Hello, Welcome to AJAX

Output












RESULT:
     Thus the Hello World Application using AJAX is designed, executed and the required output is obtained.

Reading Server Date Time from a JSP Page using AJAX
EX.NO     :    18
DATE      :
AIM:
To Develop an AJAX application to get the server date time from  a JSP page using AJAX

HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0 
  3. JDK 1.4.0 or later
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Type Html and Javascript code to send client request and receive response from server
  3. Type JSP code and store it as .jsp extension
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address
  5. Open the internet explorer. In address bar give  http://localhost:8084/ follows filename with extension to run.
  6. Observe the output.
HTML CODE:
Ajax2.html
<html>
<head>
<title>Server Date and Time using AJAX Functionality </title>
<script>
function f1()
{
window.setInterval("getTime()",1000);
}
function getTime()
{
var url = "http://localhost:8084/newFolder/serverdatetime.jsp";
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("mytime").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("POST",url,true);
xmlhttp.send();
}

</script>
</head>
<body onload="f1()">
<b> Server Time </b>  <h3 id="mytime"/>
</body>
</html>


serverdatetime.jsp

<%@page contentType="text/html" import="java.util.*" %>
<html>
<body>
<%

out.print(new java.util.Date());

%>
</body>
</html>



RESULT:
     Thus the Server Date and Time using AJAX is designed, executed and the required output is obtained.


Html Search Page using AJAX
EX.NO     :    19
DATE      :
AIM:
To Develop a Html search Page using Ajax Functionality and a server side script that returns results based on search criteria
HARDWARE REQUIREMENTS:
  1. Computer with Pentium processor
SOFTWARE REQUIREMENTS:
  1. Notepad or any editor
  2. Apache Tomcat Server 5.0
  3. JDK 1.7
  4. Internet Explorer
PROCEDURE:
  1. Open the notepad or any notepad.
  2. Type Html and Javascript code to send client request and receive response from server
  3. Type JSP code and store it as .jsp extension
  4. Save the both HTML and JSP file in apache tomcat web server ROOT address
  5. Open the internet explorer. In address bar give  http://localhost:8084/ follows filename with extension to run.
  6. Observe the output.
HTML CODE:
Ajax3.html
<html>
<head>
<title>Search Page </title>
<script>
function search()
{
var url = "http://localhost:8084/newFolder/search.jsp";
var xmlhttp;
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("stxt").innerHTML=xmlhttp.responseText;
    }
  }
var st=document.getElementById("t1").value;
st="?"+st;
xmlhttp.open("GET",url+st,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form id=f1>
Enter Search String<input type=text id=t1 size=20>
<input type=button name=b1 value=send onclick="search()">
</form>
<hr>
<h3 id=stxt />
</body>
</html>



search.jsp

<%@page contentType="text/html" import="java.util.*" %>
<html>
<body>
<%
String s1,s2,s3,s4,search_def;
s1=request.getQueryString().toUpperCase();
//s1="HTML";
search_def="Web documents are developed by HTML,Jsp is a server side scripting language,html is a client side scripting language,java technology is completely used by jsp";
s2=search_def.toUpperCase();

ArrayList arr=new ArrayList();
StringTokenizer st=new StringTokenizer(s2,",");
int count=0;
while(st.hasMoreTokens())
{
   arr.add(count,st.nextToken());
   count++;
}

int i,pos;
for(i=0;i<=count-1;i++)
{
s3=(String)arr.get(i);
pos=s3.indexOf(s1); 
if(pos!=-1)
out.print(s3+"<br>");
}


%>
</body>
</html>




























RESULT:

     Thus the Search Page AJAX is designed, executed and the required output is obtained