Frage

Using Blossom 2 and Magnolia 4.5, I am trying to do something like this:

@Controller
@Template(id = "topicpages:pages/topics", title = "MyTemplate")
public class TopicTemplate {
...
@TabFactory("DialogInclude2")
public void topicTagTab2(TabBuilder tab){
tab.addInclude("topicpages/pages/topicLayout.jsp");
}
...
}

There's a little bit more to the code, but I think this is the relevant piece. The problem is that when I attempt to include a JSP in this manner, I get the following error: Jan 3, 2013 2:48:33 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/.magnolia/dialogs/topicpages/pages/topicLayout.jsp] in DispatcherServlet with name 'controller'

I am familiar with the tutorial on dialoginclude at http://wiki.magnolia-cms.com/display/WIKI/Creating+a+custom+control+with+DialogInclude, but I'm not sure how to do this: "For a dialog to use the control it needs to define a content node named controlType with a value of 'include' and another named file whose value is the location of the JSP to be included." since all of my dialogs are created through Blossom.

War es hilfreich?

Lösung

From forum.magnolia-cms.com:

Re: Create a Custom Magnolia Control using addInclude

2 by tmattsson on Jan 8, 2013 11:04:27 AM

The include request made to render your control goes to /.magnolia/dialogs/topicpages/pages/topicLayout.jsp because you specify a relative path to the JSP. That's why it starts with /.magnolia/dialogs/. If that's not intended you should use an absolute path to your JSP. The request is handled by a Spring DispatcherServlet named controller which does not have a controller (handler) that matches this path.

Try placing the JSP directly in the WEB-INF folder and see if you can reach it with addInclude("/WEB-INF/topicLayout.jsp").

If you're trying to do an include to a Spring DispatcherServlet where a controller will render the controller(handler), then you can configure it in your module descriptor and target the include to it and the controller inside it. In this case the .jsp extension isn't necessary. It could be something like: addInclude("/custom-controls/topicLayout");

Note that it's always a good idea to keep JSP files in the WEB-INF folder where they're not accessible from the outside for security reasons. Likewise you should take care that functionality you add to support your editors within the admin interface should not be publicly available from the outside. Everything mapped below /.magnolia is protected and requires login.

Hope that helps!

// Tobias

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top