Hello Robert,

I don't think the model-class would be any more work than the servlet - 
certainly not overkill.

The Servlet can work, but as you have seen you might then run into trouble with 
the request processing - does the forward start a new request, clearing the 
request attributes? It's also a solution that is hard to follow in terms of the 
architecture (the code executed is "far away" from the template using the 
results), and it has (negligible, but still) performance impact, since *every* 
request will be checked against your servlet's path, even if only a few 
requests actually match the servlet.

To create a model-class, if you're not using STK, just extend  
"info.magnolia.module.templating.RenderingModelImpl", which is the superclass 
for all Template-Models.

Regards from Vienna,

Richard


-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] 
Im Auftrag von Magnolia Forums (on behalf of Robert Bowen)
Gesendet: Mittwoch, 14. Dezember 2011 09:58
An: Magnolia User List
Betreff: [magnolia-user] Re: Integrate with small web app

Hmmm ... well, that would be a much more elegant solution certainly. I'm just 
not sure if it's overkill for what I need to do. I mean, all I really need to 
do is take data from a form, stick it in a PreparedStatement, execute a query, 
and return some results.

Currently, it's not really a "separate webapp", it's only a servlet, and I've 
put in a .jar with the other Magnolia dependencies, in the magnoliaAuthor and 
magnoliaPublic webapps. Kind of ugly, but it more or less works. 

The only problem I am having is that I stuck the results of my query in a 
Request attribute (request.setAttribute("output",output) but when I then 
forward to my .ftl (using RequestDispatcher.forward(request,response), as 
recommended by Ruben, above) and try to print the results in my .ftl 
(${output}) Magnolia says "output doesn't exist" or something like that, and 
the page breaks.

How do you print out Request attributes in a .ftl?

If I can just figure out that bug everything would work. But I would like to 
use the method you suggest. Th only problem is that I am [b]not[/b] using STK. 
So when I make a Model class, what Magnolia class do I need to extend? Are 
there any working example out there? I've been perusing the docs and can't find 
any.

Thanks again for everyone for the helpful responses!

-- 
Context is everything: 
http://forum.magnolia-cms.com/forum/thread.html?threadId=3f254fa9-4506-4830-8eee-44a5f18da5c4


----------------------------------------------------------------
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]>
----------------------------------------------------------------





----------------------------------------------------------------
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