1

I am new to web development and facing difficulty to choose an approach from the below:

In my current project we have to build a application which will be public facing and targeted browsers "Chrome", "Safari" & "FF".

main job is to, for example we have a live feed thats going to be displayed in user screen.

The approaches we thought of is: Approach 1- By using MVC framework for example JSF/Spring MVC, controller will get the data from db, and it will update the HTML.

Approach 2- Server will give the Json/Gson response and from that response building the html using Javascript (using Jquery's .html() method)

By following the approach 1, I will have clean html, but during update the DOM tree via ajax for every new content it will be appending to the generated HTML.

By follwoing approach 2, I am finding all task like templating for clean code, feed update and html events such as click, mouse enter etc is eaiser.

Went through the following URL'S: https://softwareengineering.stackexchange.com/questions/142002/when-should-javascript-generate-html http://developer.nokia.com/Community/Wiki/JavaScript_Performance_Best_Practices Simple html vs Javascript generated html? https://developers.google.com/speed/articles/javascript-dom

Still I am trying to understand what should be approach, which one will be faster? whats Pro and Con of each approach?

Thanks for your help to make me understand

Cœur
  • 37,241
  • 25
  • 195
  • 267
Jayaram
  • 1,715
  • 18
  • 30
  • If you're going to use approach 2 you might like to look into [knockout.js](http://knockoutjs.com/). Any reason why you're ignoring IE for a public-facing site? IE has a bigger market share than FF and a much bigger market share than Safari. – nnnnnn Sep 11 '13 at 11:50
  • @nnnnnn, Thanks for the comment, Yes I do agree for IE, it will be supportive to IE, but in case something failing/wrong for intial release that can be ignore after all its bussiness who will decide..and thanks for knockout.js, seems it will help me for templating as well.. I will have a look – Jayaram Sep 11 '13 at 12:04
  • Not sure how much you care about accessibility of your page? https://en.wikipedia.org/wiki/Unobtrusive_JavaScript – Bergi Feb 24 '18 at 07:26

0 Answers0