Dispaly Backend data using AngularJS in Java web Application - java

How to display Backend data using AngularJS in Java web Application.
Do I need to use RESTfull Web Services.
If I don't want to use RESTfull web services, then how should I proceed.
(In my java web application m using Spring and Hibernate.)

AngularJS is a framework used to develop single page web applications which doesn't need refreshing and will act like a mobile application.
For this purpose, all the data required by the front end needs to come from some sort of a backend API. REST is widely used for this purpose in many leading high scale websites like twitter/facebook etc.
You should develop your Java Web Application as an API without no/less HTML pages and use that in your AngularJS front end.

RESTfull web services provide and easy way to integrate your AngularJS frond end with database. It is the most popular one. But it is not the only one.
You can also achieve this via different techniques.
All you need is to make call to a server technology that returns a JSON object.
That particular server technology (even a simple JSP/Servlet) can interact with database and return the expected data in JSON format.
This link provides a simple example to help you begin with.

Related

Migrating Spring MVC application from JSP to AngularJS

I am considering moving from server-side rendering view technologies like JSP, Struts to client-side rendering view technologies using AngularJS,
A popular Javascript framework for modern browsers.
When we are making this change and what are all the things that I may encounter.
If anybody who are experienced in Spring Web MVC and JSP development and would know how Spring MVC can work together with a client-side Javascript like AngularJS.
Kindly Answer.
You have to rewrite the view part using angularJS, and replace the logic from the server with a REST API.
It's often a huge work, and the hardest part is to migrate the existing server-side session management to the browser, because a REST API is stateless.
Below is one of the suggested way in which i recently migrated my existing spring MVC web-application in Single page application using AngularJs as client side java-script framework:
1).First you needs to bisect your core business logic which must needs to handle in DB layer,if not done already. i.e. SP's,trigger's,etc...
2).Then for the thing mentioned as hardest by Toilal ("to migrate the existing server-side session management to the browser, because a REST API is stateless"), you can consider Spring Boot as one of the options to build things quickly instead of Spring MVC with fusion of java8 features to yield the JSON response via API's.
3).And than last but not the least, build UI layer with AngularJS in front End encapsulating the data returned by the spring boot API's. Please note that as angular is super power full, you can do most of your business logic at client side,your DB layer just needs to give you the whole bunch of business data to render the screen,other things you can easily handle in angular.
Thus, this way by making the DB layer thin and imbibing angular at front end, you can improve performance of your existing application drastically.
You can also check this AngularJS with Spring-mvc useful thread in same context.

Separate frontend and backend in Java - Spring MVC Framework

I'm new at Spring MVC framework i want to learn how to fully separate frontend(html,js etc.) and backend(java).
I'm going to use RESTfull services, play with JSONs.
I think i'm going to build Single Page Application.
Most of tutorials shown in jsp pages which i dont like.
I saw my friends company project(Using Spring MVC) they used Embedded Jetty server and in server configuration they assigned two different paths for frontend and backend paths.
I saw frontend codes there was only html javascripts etc. on the backend side the approach was the same.(Fully Separated !!!)
My question is:'How they pass requests from frontend to backend and get results from backend and update frontend'.
Also they were using Maven backend and frontend defined as modules in the root.
Could you share tutorials so i can understand playing with codes ?
'How they pass requests from frontend to backend and get results from
backend and update frontend'
They probably use HTTP[S] as the transport and JSON as the data representation format. Browsers support AJAX which allows you to make HTTP connections without reloading the page.
Could you share tutorials so i can understand playing with codes ?
No, that's not what this site is for.
Comments:
JSP is still very useful for generating HTML on the server. This is pretty close to necessary if you want Google to crawl your site.
Check out Spring Data REST for a framework for quick REST APIs.
Also check out ExtJS or Dojo for good Single Page App frameworks.

AngularJS + Spring Project architecture

I am planning to start a project and I am looking for the best approach to make a RIA application using AngularJS.
Right know I am pretty sure of those technologies:
AngularJS (+ bootstrap CSS) for the client UI, logic and server
requests.
Spring for bootstrapping the server business logic.
Hibernate + MySQL for persistent data access
Jersey for the Restful web service API.
Spring Security for url and data protection over authentication.
The only piece I feel is not ok is that my application will not be the typical one page app, because it will be large and I want to break it into multiple one page apps, some protected and others public. To serve every index.html I want another technology like Spring MVC, making those small one page apps secure for this points, and also not allowing the access to some resources.
¿Do you think this is a good approach or you would change any of this technologies (like supressing jersey/Spring MVC redundant dependencies)?
i think that in general your aprroach is a good one, but maybe you could use the webapp generator yeoman with the JHispster, a java web app generator.
Or if you don't like the ideia you could add to your data access layer the Spring-Data-JPA, because you will avoid to write the boilerplate code.

Integrating OBIEE with web application

I have a requirement where I need to integrate OBIEE reports with my J2EE based web application. On going through the available documentation, I have understood there are various ways of integration. I am particularly looking for below two methods:
Go-URL
Web service
I wanted to know how will I get to know which web service to use and how. Also, what is the response format of web services, can it be a PDF or image document? I want to integrate using web services because I want control of the report document in my web application and store it in database or a DMS system or digitally sign it before providing it to end user.
How will I know the web service WSDL and pass the filter parameters in the web service request and also specify the response format of the report?
You can find the Web Services documented here: http://docs.oracle.com/cd/E28280_01/bi.1111/e16364/soa_overview.htm#BABHJJAC
Update:
From what I can see, the OBIEE web services don't support export to PDF/image.
If you want to work directly with PDFs, you might need to look at using BI Publisher (BIP) instead, which also supports Web Services. BI Publisher can query existing OBIEE analyses and RPDs. You can also call BIP directly from within a Java application using the available APIs.

How to create Single Page Application (SPA) in java with hibernate and MySQL

I'm trying to choose best set of tools to create Single Page Applications. I would like to be able to use Java and Hibernate on server side along with MySQL. But what about ajax layer of SPA?
Maybe I have entirely wrong idea about that and Java and Hibernate make no sense in this case? But than how to implement complex server side operations?
It's rather question of UI part. The page asks a server for pages data. Java + hibernate could be used to implement service (e.g. REST service which returns data in JSON format). You can use SpringMVC to implement the service.
AJAX calls the service and process obtained data.
You can use angularJS for creating Single Page Application. this is the best framework i found for SPA development so far and using in most of projects developing which needs SPA.
for sample application refer to github
and detail about angularJS

Categories