Integrating Magnolia with Spring Framework is something that comes up in many projects. Magnolia Blossom is the Spring integration module that makes this easier then ever through its Spring centric approach. With Blossom on your tool belt you can build truly interactive websites. A common use case is integrating a website with a back end business system, here Blossom truly shines as it helps you take advantage of Spring's proven application stack.
This session will focus on how the Blossom module is used and its benefits. You will learn how Blossom uses annotations to expose Spring Web MVC as paragraphs and templates and how this gives you some very nifty features.
3. Why use Spring? Why use Spring? Magnolia is a registered trademark used by permission
4.
5.
6.
7.
8. Model View Controller Pattern Magnolia is a registered trademark used by permission Controller Model View The controller receives input, performs requested operations and provides the resulting model. The view is responsible for providing the UI representation of the model. Keeps business logic separated from presentation.
9. Spring Web MVC Annotation Based Controller Annotation Based Controller Magnolia is a registered trademark used by permission @Controller public class BookController { @ Autowired private BookStoreWebService webService ; @ RequestMapping ( "/book" ) public ModelAndView handleRequest (@ RequestParam ( "id" ) int bookId ) { ModelAndView mav = new ModelAndView ( "book.jsp" ) ; mav . addAttribute ( "book" , webService . getBook ( bookId )) ; return mav ; } } http://acmebookstore.com/book?id=1327
10. How can Spring Web MVC fit in Magnolia? Magnolia is a registered trademark used by permission Template Paragraph Paragraph
11. Blossom managed templates and paragraphs Magnolia is a registered trademark used by permission Template C M V Paragraph C M V Paragraph C M V Templates and paragraphs are decoupled from view rendering
12. Pre-executing a controller (paragraph) Magnolia is a registered trademark used by permission Template C M V Paragraph C M V Paragraph C M V C The pre-executed controller can choose to skip page rendering by sending a redirect or directly render something on its own
13.
14.
15. Templates Magnolia is a registered trademark used by permission @Controller @Template("Two Columns") public class TwoColumnsTemplate { @ RequestMapping ( "/twoColumns" ) public ModelAndView handleRequest () { return new ModelAndView ( "twoColumnsTemplate.jsp" ) ; } }
16. Paragraphs Magnolia is a registered trademark used by permission @Controller @Paragraph(value = "Simple paragraph", dialog=”simple-dialog”) @ParagraphDescription("Simple paragraph that renders a JSP") public class SimpleParagraph { @ RequestMapping ( "/simple" ) public ModelAndView render () { return new ModelAndView ( "simpleParagraph.jsp" ) ; } }
17.
18. Blossom managed dialogs Magnolia is a registered trademark used by permission @DialogFactory("page-dialog") public class PageDialog { @ TabFactory ( "Content" ) public void contentTab ( TabBuilder tab ) { tab . addEdit ( "title" , "Title" , "Title of this page" ) ; tab . addCheckbox ( "navigation" , "Navigation" , "Include page in menu" ) ; } @ TabFactory ( "Meta" ) public void metaTab ( TabBuilder tab ) { tab . addEdit ( "author" , "Author" , "" ) ; tab . addEdit ( "keywords" , "Keywords" , "Keywords for this page" ) ; tab . addEdit ( "description" , "Description" , "Concise page explanation" ) ; } }