spring - web-app backend architecture -


i starting new web app hobby , had difficulty architecture.
frond end html , javascript requests.
, backend ,will implemented in java , using spring framework.

lets example library page user can view books , personal information.

personal info ------------- book 1 book 2 book 3 

i want implement features 2 rest services ,one personal information ,and books person has.

ex . www.mybib.org/users/123/ www.mybib.org/users/123/books/ 

the thing ,when user first request home page view books , personal information ,how compose page.

  • use servlet / controller replicate code of 2 rest services , redirect jsp format html , javascript. once first load done, each update on page use rest services .
    i think bad design.

  • from servler / controller call rest services , call jsp in order compose html , javascript output.then each update call rest services.

  • from servlet / controller return html layout , make javascript make 2 ajax request when loading page.

  • ...or else.

as can see pretty new , in fact first attemp biuld simple web application.

the easiest way have kind of indexcontroller after, fetching current users list of books renders page right away, no ajaxy rest calls needed.

if new of this, that's how start out. may want have @ code in spring 'petclinic' sample application: https://src.springframework.org/svn/spring-samples/petclinic

if must use ajax, i'd still have indexcontroller , index.jsp renders initial page. after javascript code can make rest calls, implement different controller.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -