Skip to main content

Mini Project: One Model, Three Views: HTML, JSON and Redirect

Learn Mini Project: One Model, Three Views: HTML, JSON and Redirect (View Technologies, Spring MVC) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

Mini Real-Time Project: One Model, Three Views: HTML, JSON and Redirect Problem The same product data must be shown as an HTML page for browsers, as JSON for an app, and some URLs must redirect. Show how the view layer turns one model into different results. Requirements Render a model to HTML with a template engine (Thymeleaf). Render the same model as JSON with a JSON view. Use a redirect view. Show how view names select the view type. Concepts Used View and ViewResolver Thymeleaf template engine MappingJackson2JsonView RedirectView / redirect: ContentNegotiatingViewResolver idea Maven...

More lessons in View Technologies