may be it is not a worthy question but i am new at angular js that is why going to ask this ! I have a small portal which has forms develop in jsp. Now my requirement is to display data from db on page by not moving to next page using Angular JS. Can i do this easily using jsp? or I should use c#? But transferring from jsp to c# will be quite daunting task! I shall be very great full if someone suggest a way using jsp.
Kind Regards.
1 Answer 1
If you can return/echo json files from JSP and you can consume requests (get,post,update delete) coming to it and redirect it to whatever handles the business logic (e.g controllers) then you are set to go. I believe with JSP you mean JSP + Java Servlets + Java Beans. Or in other words controllers better be Java classes. If that is your case, then you definitely can do that without converting to C# + ASP.NET ;)
Update:
The fact that you are only using JSP is good for starters but as you get better and want the application to scale more you need to move talking with the database in a Java class/servlet. JSP should be used only for presentation/templating and no business logic (if/else this that). Now you are consuming your request names from the form like username password etc.. With angularJS will be the same. The main difference is that angular will submit the form with ajax so no page redirection will happen (there are many questions in stackoverflow how to stop a form from submitting). Then the JSP will have to return/print some json and this will be returned to angularjs for rendering that in your page.In other words there will be no html in your JSP. All the templating will happen in the client side (Javascript/AngularJS)
Links:
Introduction to Angular.js in 50 Examples (part 1) https://www.youtube.com/watch?v=TRrL5j3MIvo
Introduction to Angular.js in 50 Examples (part 2) https://www.youtube.com/watch?v=6J08m1H2BME
Free Interactive AngularJS learning for Beginners https://www.codeschool.com/courses/shaping-up-with-angular-js
Head First Java Servlets and JSP Book ( http://www.headfirstlabs.com/books/hfsvlt/ )
Introduction to MVC with Java Servlets and JSP (http://blog.oscarscode.com/java/introduction-to-mvc-with-servlets-and-jsp/)
How to send JSON from JSP to Javascript: https://code.google.com/p/json-simple/wiki/JSPAndAJAXExamples
How to submit JSON form data to Server-side using AngularJS/ajax: http://scotch.io/tutorials/javascript/submitting-ajax-forms-the-angularjs-way#submit-the-form-with-angular
Angular+ Java Restful services (http://draptik.github.io/blog/2013/07/13/angularjs-example-using-a-java-restful-web-service/)
Java + AngularJS Tutorial Part 1 (http://www.radcortez.com/java-ee-7-with-angular-js-part-1/)
Java + AngularJS Tutorial Part 2 (http://www.radcortez.com/java-ee-7-with-angular-js-crud-rest-validations-part-2/)
For Jquery Thinkers - Thinking in AngularJS If I have a Jquery Bcakground "Thinking in AngularJS" if I have a jQuery background?