|
I have a 'show' action that displays a few tables of data and it works just fine. However, I've been asked to modify my app so this page is only created once (creating it is slow, lot of calcs and db hits). The idea is that the original content should be saved to an html file that can be shown for subsequent visits to that web page and/or emailed.
This sounds like it should be easy, but I'm kind of a newbie. I've seen some mention of a pdf rendering service that allows you to save content as pdf, but I just need html. Thanks. |
|
You could do that but why not just use the SpringCache plugin?
http://grails.org/plugin/springcache -- Jonathan Rosenberg Founder & Executive Director Tabby's Place, a Cat Sanctuary http://www.tabbysplace.org/ On Mon, Apr 9, 2012 at 3:50 PM, bcarroll <[hidden email]> wrote: > I have a 'show' action that displays a few tables of data and it works just > fine. However, I've been asked to modify my app so this page is only > created once (creating it is slow, lot of calcs and db hits). The idea is > that the original content should be saved to an html file that can be shown > for subsequent visits to that web page and/or emailed. > > This sounds like it should be easy, but I'm kind of a newbie. I've seen > some mention of a pdf rendering service that allows you to save content as > pdf, but I just need html. > > Thanks. > > -- > View this message in context: http://grails.1312388.n4.nabble.com/Can-I-render-output-to-an-html-file-tp4543666p4543666.html > Sent from the Grails - user mailing list archive at Nabble.com. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
In reply to this post by bcarroll
An idea (from a newbee as well) .
as far, as I understand grails , you can render the HTML-Page (with render) and instead of showing the content, so store it in a file (.HTML). This html-content can that be shown this time and every next time as well. Yours Bernhard |
|
In reply to this post by Jonathan Rosenberg
Hi,
You could also use the GSP Resources plugin to render the GSP output to an HTML file, when the server starts up. The resources framework won't let you use the view directly as a resource, but you could create a file called (for example) web-app/somedir/somepage.html.gsp, containing the following code: <g:include controller="somecontroller" action="show" /> You would then need to add some configuration to your grails-app/conf/AppResources.groovy file, like so: modules = { somepage { }
resource url:'/somedir/somepage.html.gsp', attrs:[type:'js'] }Your HTML page would then be accessible from http://localhost:8080/yourapp/somedir/somepage.html (Note that the above config specifies the type as 'js', because the resources framework expects javascript- or css-type files. But don't worry - it'll be served up as plain HTML.) Cheers, Francis On 9 April 2012 21:57, Jonathan Rosenberg <[hidden email]> wrote: You could do that but why not just use the SpringCache plugin? |
| Powered by Nabble | Edit this page |
