Scenario:
I am inside a paragraph (see snippet):
- ${categoryPage} is of type DefaultContent and determined by the controller (see snippet). The contentNodeIterator iterates through the content, but <cms:includeTemplate/> doesn't produce any output.
Basically what I want is:
- Display a search form to the user - works
- Process a Search via the controller - works
- The controller does a JCR query based on the search results. In my case I am doing a request to a schopping api, get the category Id and determine the corresponding content page for this id. I then put the page (categoryPage) into the request. - works
- the controller then uses a template to display the search result - works
- the template displaying the search result should include parts of the categoryPage, which doesn't work.
Any suggestions?
code snippet
Can you show me how you're using includeTemplate?
Try to export the node to be rendered, check to see that the paragraph in the metadata is correct.
Debug BlossomParagraphRenderer to see that it's called.
I am calling <cms:includeTemplate> in a _Paragraph_ template, not in a page template. (see attached file).
BlossomParagraphRenderer .render() is called 3 times, which is correct in my case. First call is the paragraph which belongs to my search controller. the two other calls to render() are dealing with the paragraphs of the page I determined based on the search result.
So everything seems to work fine, but no output is produced.
When I debug BlossomParagrapRenderer (line 71):
context.setParagraph(paragraph);
pragraph.templatePath is null and type is "blossom", modelClass is of type info.magnolia.module.templating.RenderingModelImpl
do these values seem to be correct?
I've just seen that only the first controller (SearchController) is being called. The other controller (ArticleController), which is needed to display the other paragraphs is not being called. To sum it up:
POST request to page A -> BlossomParagraphRenderer.render() -> SearchController.doPost() -> determine magnolia content page B based on search result -> put B into request -> render template for A -> iterate over paragraphs of B -> cms:includeTemplate for each paragraph -> BlossomParagraphRenderer.render() -> ? Here, the Controller for B's paragraph should be called I assume ?
UPDATE:
I switched from jetty to tomcat (forgot to mention, sorry) and everything works as expected. So this seems to be a jetty-related problem.
That's very strange, could be a problem with how blossom wraps the request then. If you set spring to log debug info then the DispatcherServlet will log what path it can't find a controller/handler for.
I've attached some log output from tomcat and jetty:
log-jetty-and-tomcat.txt
Okay, I see the problem, in jetty the contextPath blip-author is included when rendering the view.
2010-06-14 13:15:13,807 DEBUG lia.module.blossom.render.BlossomDispatcherServlet:
DispatcherServlet with name 'blossom' processing POST request for [/blip-author/WEB-INF/templates/blip/paragraphs/searchForm.jsp]
Blossom will have to test for this and remove it if present. For now stick to Tomcat. =)
ok, thanks for your help!
Unable to reproduce, tried with jetty 8.0.0.M1
The problem appears to be related to JSP's being dispatched to the BlossomDispatcherServlet instead of the JSP redering servlet.
This output in the logs for jetty, which does not appear in the tomcat logs reveals the problem.
2010-06-14 13:15:13,807 DEBUG lia.module.blossom.render.BlossomDispatcherServlet: DispatcherServlet with name 'blossom' processing POST request for [/blip-author/WEB-INF/templates/blip/paragraphs/searchForm.jsp]
This issue is continued in Magnolia JIRA here:
http://jira.magnolia-cms.com/browse/BLOSSOM-6