Sunday, 24 January 2016

simple login web service

package dat;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;

@Path("/login")
public class LoginService {

@POST
    @Path("/add")
@Produces("application/json")
    public Response getDate(
            @FormParam("email") String email,
            @FormParam("pwd") String pwd  )
             {
 
       String actualdetails = email + " " + pwd ;
 
       return Response.status(200)
        .entity("your details : " + actualdetails)
        .build();
    }
}


===============================

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="first/login/add" method="post">  
Enter Email:<input type="text" name="email"/><br/><br/>  
Enter Password:<input type="text" name="pwd"/><br/><br/>  
  
<input type="submit" value="Login"/>  
</form>  
</body>
</html>

Friday, 22 January 2016

Collections -- ArrayList

public class ArrayLists {

    public static void main(String[] args) {
        ArrayList<String> als = new ArrayList<String>();
       
       
        als.add("Name1");
        als.add("Name2");
        als.add("Name3");
        als.add("Name4");
        als.add("Name5");
        als.add("Name5");
       
        Iterator itr = als.iterator();
        while(itr == itr.next())
        {
            System.out.println(itr.next());
        }
       
        }
       
       

    }


in place of iterator we can use for loop also.... it is up to you how you use the traditional for loop or new for loop syntax.

for example:

public class ArrayLists {

    public static void main(String[] args) {
        ArrayList<String> als = new ArrayList<String>();
       
       
        als.add("Name1");
        als.add("Name2");
        als.add("Name3");
        als.add("Name4");
        als.add("Name5");
        als.add("Name5");
       
       for(String alsObject : ls)
        {
         System.out.println(alsObject);
         }
        }
       
       

    }

here the array list is the in memory data structure.
it can contain duplicate values.
its an dynamic array(same as arrays concept).
the add() method adds the values to the array list, later they can be retrieved by using iterator.
random access of the values or the objects is possible.
it is slow compared to other collection data structures
note: Collection framework is a generic one.......

Wednesday, 6 January 2016

JavaForYouGuys

Hi this JavaForYouGuys!!!!

Lets not go the history of java, from where it came, who was the author and all. we discuss about java in market, How new technologies are using java and stuff.

Present the era is for BigData. And Hadoop is the solution for it. Do you know on which platform it is made. its JAVA. the MapReduce algorithms are of java made. What not with java. there is a huge demand of java. lets have a great time working with Java. We talk about JavaEE and Core Java.But to say its entirely java thing.

Before Starting we should have main to important things:
1. Laptop/Desktop with internet.(though its silly to mention)
2. Eclipse or NetBeans IDE to work around with Java (See it also have JavaEE support)