Hi Alessandro,

I'll try to make my explanation really basic, assuming you've just started and 
don't have the basics figured out.

In standard Spring Web MVC all you need to do is add methods with 
@RequestMapping and Spring will happily route requests to these methods and all 
is fine.

Blossom turns this on its head a bit as it connects Spring Web MVC to the CMS 
rendering engine. When a request comes in its processed by Magnolia first, 
Magnolia maps the request to a page and starts to render it. It will first 
execute the template assigned to the page. The template renders its view, 
either a freemarker or jsp. In Magnolia we call these template scripts to 
disambiguate the term template. The template script uses jsp tags or freemarker 
directives to render areas within the page. An area contains components. All 
three entities, page, areas and components can be implemented as Spring 
controllers and they all have template scripts. When the area renders it 
performs rendering of all the components within it.

Your component will be executed when its used in an area. The request comes to 
it from the rendering engine having passed through the page its on and the area 
its in. The path you specified in the @RequestMapping annotation is not used to 
route the request to the method. In fact it doesn't matter what you put there, 
as long as its unique. Instead what matters is the id you specify in the 
@Template annotation.

If you add this component to an area the viewForm method will be called when 
the page is rendered. It should return a string that identifies which template 
script to use, a JSP or a freemarker template. The template script outputs an 
html form that submits to the current page <form action="" method="POST">. When 
the user submits the form the request gets handled by Magnolia which renders 
the page, then the area and when it comes to the component using your 
controller the handleSubmit submit will be called and can handle the submit. In 
your code you're using a property successPage configured when the component was 
added to the area. The user that added the component filled this out using the 
component's dialog. I notice your component doesn't have a dialog so the 
property won't be there so it will fail. To fix this add a dialog that lets the 
user specify the success page.

A good place to start when learning to use Blossom is the sample. It has a 
number of components and some of them use forms just like you're trying to do 
here. The sample is our git repository and instructions on using it can be 
found here http://documentation.magnolia-cms.com/display/DOCS/Blossom+module

When you're ready to set up your own project use the archetypes described here 
http://documentation.magnolia-cms.com/display/DOCS/Getting+started+with+Blossom

Hope that helps, Tobias

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=4064ba49-653e-40a0-b01b-c30cb984015c


----------------------------------------------------------------
For list details, see http://www.magnolia-cms.com/community/mailing-lists.html
Alternatively, use our forums: http://forum.magnolia-cms.com/
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to