JQuery, Angular JS and Java

Update: One main difference of Angular JS from Jquery is that Angular JS binds HTML elements and controls it in HTML/JSP file, with much less usage of the *.js ( javascript ) unlike Javascript with JQuery. Angular JS has additional attributes called Directives.

Angular JS – A new Javascript Framework that was launched last 2009. For some background, Javascript is a Client-Side scripting for websites. In layman’s term ( or just to make things easier to understand ), Javascript is used to manipulate the menus, buttons, and text fields in a website. Then JQuery comes in as an enhancement ( a set of JavaScript libraries / standard codes ) to encapsulate routine JavaScript code. JavaScript with JQuery creates a much better and code, and with lesser lines, than just JavaScript alone.

Then here comes Angular JS. Angular JS is a Framework. Its not an-add on Library unlike JavaScript. But first, Let’s differentiate a Framework from a Library. To start, a library is a set of additional instructions, mostly common functions that are simplified that are ready to use. Think of it as a set of tools in a tool box. Framework, as other developers say, is just the same as a Library. But then why is it called Framework? For example, Spring Framework as just a Spring Library? Well, I think here’s the difference. Yes a Framework is also a set of common used functions, but the difference is that a Framework is a built-in software platform that is used to enhanced software. Libraries may relate to tools, while Framework may relate to a simple mechanical machine. For example, you can use a pen, a paper and a cash box as a cash register. This is a similar concept of a Library. But then you use a cash register machine, which is a similar concept of a Framework.

Angular JS can write lesser code than JQuery. And Angular JS can do more stuff than JQuery, especially in the unit test area. These are the two main reasons why a lot of Software Developers / Companies are trying out Angular JS development. But other experienced developers are sticking to the JQuery, since Angular JS is not yet time tested. There are still some hesitations, but there is potential.

Here are some reference links on Angular JS:
– JQuery / Angular JS comparison
https://www.airpair.com/angularjs/posts/jquery-angularjs-comparison-migration-walkthrough

– Offical Angular JS page
https://angularjs.org/

– Angular JS and Java Backend intergration using REST
http://www.radcortez.com/java-ee-7-with-angular-js-crud-rest-validations-part-2/
http://www.radcortez.com/java-ee-7-with-angular-js-part-1/

Advertisements

Coding in REST JERSEY Basics

1. ) In the class declaration, the @PATH annotation is declared.
this path will be the corresponding to this class will process.
example:

@PATH (“/login”)
public class Login(){

2. ) the methods will have the annotation if what is its type,
what it produces, or what it consumes. Also the sub path is included.

example method annotation types are:
@GET, @PUT, @DELETE

example of @Produces are:
application/json, application/xml, text/plain, text/html

here a sample code:

@GET @Path(“/user”)
@Produces(“application/json”)
public Login getUser() { … }

See 3.3 Sub-resources section of this link below:

https://jersey.java.net/nonav/documentation/latest/user-guide.html#d0e1746

What is REST and JERSEY

REST – REST is a software architecture specification. It is a design on using HTTP URLsĀ  to retrieve and set information on the system. Rest is a webservice the accepts an HTTP URL string, with specifications on how to parse this URL and converts it to an execution.

JERSEY – This is a Java implementation of the REST architecture. Although there are several implementations, ( you can even create your own ), Jersey is the most widely used and it is based on the javax.ws.* libraries. The Jersey implementation is under the Glassfish software therefore its libraries are using org.glassfish.jersey.*

See Oracle’s Introduction of Jersey:
http://www.oracle.com/technetwork/articles/java/jersey-part1-159891.html

The Jersey 2.10.1 API documentation:
https://jersey.java.net/apidocs/latest/jersey/