[Lift] Re: how to serve html fragments
The problem seems to be a known stupid bug in IE6.. see: http://www.webdeveloper.com/forum/showthread.php?t=1658 On 29 jun, 02:39, David Persons dhwpers...@gmail.com wrote: I spend a lot of time today on (close to) the same problem.. IE 6 was not showing my site in strict mode.. with the strict doctype set correctly I thought.. : ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; The problem was the order of the two lines.. Seems that to have IE pick up the correct doctype, the html HAS TO START with the doctype. Changing the order makes IE show my website perfectly: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; ?xml version=1.0 encoding=UTF-8? How to change the order in my code so that Lift spits out my pages correctly? regards, David Persons On 6 jun, 17:13, fatu fab...@gmail.com wrote: Thanks a lot for the info David, then I'll consider reverting to 2.7.4 until Lift integrates the latest Scala Actors lib (and fixes). Fabio On 6 Giu, 15:58, David Pollak feeder.of.the.be...@gmail.com wrote: Lift is 2.7.4. We have not upgraded to 2.7.5 as the delta is actor fixes in response to lift-related tickets that we solved with our own actor impl. I'm talking to Philipp Haller today at the Lift Off about how to proceed. On Jun 6, 2009 6:49 AM, fatu fab...@gmail.com wrote: 2.7.5 right now (and a fresh maven repo too) but I think (not sure though) I had it with 2.7.4 as well. Seems to expect a refSet field in ActorGC which i couldn't find in 2.7.5 sources. Fabio On 5 Giu, 18:10, David Pollak feeder.of.the.be...@gmail.com wrote: Are you using Scala 2.7.4 or... On Fri, Jun 5, 2009 at 7:37 AM, fatu fab...@gmail.com wrote: Fantastic, it works great! ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
I just pushed a patch that will flip the DocType and ?xml version=1.0 encoding=UTF-8? if the browser is IE6 On Mon, Jun 29, 2009 at 12:20 AM, David Persons dhwpers...@gmail.comwrote: The problem seems to be a known stupid bug in IE6.. see: http://www.webdeveloper.com/forum/showthread.php?t=1658 On 29 jun, 02:39, David Persons dhwpers...@gmail.com wrote: I spend a lot of time today on (close to) the same problem.. IE 6 was not showing my site in strict mode.. with the strict doctype set correctly I thought.. : ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; The problem was the order of the two lines.. Seems that to have IE pick up the correct doctype, the html HAS TO START with the doctype. Changing the order makes IE show my website perfectly: !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd; ?xml version=1.0 encoding=UTF-8? How to change the order in my code so that Lift spits out my pages correctly? regards, David Persons On 6 jun, 17:13, fatu fab...@gmail.com wrote: Thanks a lot for the info David, then I'll consider reverting to 2.7.4 until Lift integrates the latest Scala Actors lib (and fixes). Fabio On 6 Giu, 15:58, David Pollak feeder.of.the.be...@gmail.com wrote: Lift is 2.7.4. We have not upgraded to 2.7.5 as the delta is actor fixes in response to lift-related tickets that we solved with our own actor impl. I'm talking to Philipp Haller today at the Lift Off about how to proceed. On Jun 6, 2009 6:49 AM, fatu fab...@gmail.com wrote: 2.7.5 right now (and a fresh maven repo too) but I think (not sure though) I had it with 2.7.4 as well. Seems to expect a refSet field in ActorGC which i couldn't find in 2.7.5 sources. Fabio On 5 Giu, 18:10, David Pollak feeder.of.the.be...@gmail.com wrote: Are you using Scala 2.7.4 or... On Fri, Jun 5, 2009 at 7:37 AM, fatu fab...@gmail.com wrote: Fantastic, it works great! ... -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
2.7.5 right now (and a fresh maven repo too) but I think (not sure though) I had it with 2.7.4 as well. Seems to expect a refSet field in ActorGC which i couldn't find in 2.7.5 sources. Fabio On 5 Giu, 18:10, David Pollak feeder.of.the.be...@gmail.com wrote: Are you using Scala 2.7.4 or 2.7.5? On Fri, Jun 5, 2009 at 7:37 AM, fatu fab...@gmail.com wrote: Fantastic, it works great! I'm getting an unrelated exception, perhaps that's something in flush (looks a bit like it from the trace) and you already know but just in case: java.lang.NoSuchFieldException: refSet at java.lang.Class.getDeclaredField(Class.java:1882) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:715) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:707) at scala.actors.Reaction.run(Reaction.scala:78) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anonfun$20$$anon$2.run (LiftServlet.scala:626) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Thanks again. Fabio On 5 Giu, 10:58, fatu fab...@gmail.com wrote: I've had a look at your commit and skipDocType should now remove the decl. as well. I'll try it out as soon as I can get a snapshot build of it. Many many thanks so far. Fabio On 4 Giu, 19:06, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Jun 4, 2009 at 10:04 AM, Timothy Perrett timo...@getintheloop.euwrote: Have you pushed this change? Its not showing on github? I pushed, but forgot to commit... :-) That's me, I just can't commit. All committed and pushed. Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Lift is 2.7.4. We have not upgraded to 2.7.5 as the delta is actor fixes in response to lift-related tickets that we solved with our own actor impl. I'm talking to Philipp Haller today at the Lift Off about how to proceed. On Jun 6, 2009 6:49 AM, fatu fab...@gmail.com wrote: 2.7.5 right now (and a fresh maven repo too) but I think (not sure though) I had it with 2.7.4 as well. Seems to expect a refSet field in ActorGC which i couldn't find in 2.7.5 sources. Fabio On 5 Giu, 18:10, David Pollak feeder.of.the.be...@gmail.com wrote: Are you using Scala 2.7.4 or... On Fri, Jun 5, 2009 at 7:37 AM, fatu fab...@gmail.com wrote: Fantastic, it works great! ... --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
I've had a look at your commit and skipDocType should now remove the decl. as well. I'll try it out as soon as I can get a snapshot build of it. Many many thanks so far. Fabio On 4 Giu, 19:06, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Jun 4, 2009 at 10:04 AM, Timothy Perrett timo...@getintheloop.euwrote: Have you pushed this change? Its not showing on github? I pushed, but forgot to commit... :-) That's me, I just can't commit. All committed and pushed. Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Fantastic, it works great! I'm getting an unrelated exception, perhaps that's something in flush (looks a bit like it from the trace) and you already know but just in case: java.lang.NoSuchFieldException: refSet at java.lang.Class.getDeclaredField(Class.java:1882) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:715) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:707) at scala.actors.Reaction.run(Reaction.scala:78) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anonfun$20$$anon$2.run (LiftServlet.scala:626) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Thanks again. Fabio On 5 Giu, 10:58, fatu fab...@gmail.com wrote: I've had a look at your commit and skipDocType should now remove the decl. as well. I'll try it out as soon as I can get a snapshot build of it. Many many thanks so far. Fabio On 4 Giu, 19:06, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Jun 4, 2009 at 10:04 AM, Timothy Perrett timo...@getintheloop.euwrote: Have you pushed this change? Its not showing on github? I pushed, but forgot to commit... :-) That's me, I just can't commit. All committed and pushed. Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Are you using Scala 2.7.4 or 2.7.5? On Fri, Jun 5, 2009 at 7:37 AM, fatu fab...@gmail.com wrote: Fantastic, it works great! I'm getting an unrelated exception, perhaps that's something in flush (looks a bit like it from the trace) and you already know but just in case: java.lang.NoSuchFieldException: refSet at java.lang.Class.getDeclaredField(Class.java:1882) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:715) at net.liftweb.http.PointlessActorToWorkAroundBug$$anonfun$act$1$ $anonfun$apply$1.apply(LiftServlet.scala:707) at scala.actors.Reaction.run(Reaction.scala:78) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anon$1$$anonfun$execute $1.apply(LiftServlet.scala:668) at net.liftweb.http.ActorSchedulerFixer$$anonfun$20$$anon$2.run (LiftServlet.scala:626) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask (ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Thanks again. Fabio On 5 Giu, 10:58, fatu fab...@gmail.com wrote: I've had a look at your commit and skipDocType should now remove the decl. as well. I'll try it out as soon as I can get a snapshot build of it. Many many thanks so far. Fabio On 4 Giu, 19:06, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, Jun 4, 2009 at 10:04 AM, Timothy Perrett timo...@getintheloop.euwrote: Have you pushed this change? Its not showing on github? I pushed, but forgot to commit... :-) That's me, I just can't commit. All committed and pushed. Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Yes it does indeed. Sorry, I was getting confused by the fact that Firefox still doesn't like the fragment but it happens both when using a view and when using a template + snippet. The DOCTYPE is indeed missing in both cases when S.skipDocType is on, I guess what's still causing trouble is the fact that the XML declaration is still there. I think I can remember seeing somewhere (group? blogs?) another flag that, when turned on, would skip the XML declaration but I can't find it right now. Is there really such a thing or did I only dream about it? Thanks. On 3 Giu, 17:57, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jun 3, 2009 at 7:40 AM, fatu fab...@gmail.com wrote: ...Another question for now :-) Does it work for views as well? It should. Views are treated just like static XHTML files... a source of NodeSeq Many thanks. Fabio On 21 Mag, 15:38, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy
[Lift] Re: how to serve html fragments
On Thu, Jun 4, 2009 at 12:10 AM, fatu fab...@gmail.com wrote: Yes it does indeed. Sorry, I was getting confused by the fact that Firefox still doesn't like the fragment but it happens both when using a view and when using a template + snippet. The DOCTYPE is indeed missing in both cases when S.skipDocType is on, I guess what's still causing trouble is the fact that the XML declaration is still there. I think I can remember seeing somewhere (group? blogs?) another flag that, when turned on, would skip the XML declaration but I can't find it right now. Is there really such a thing or did I only dream about it? Lemme see what I can do. Thanks. On 3 Giu, 17:57, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jun 3, 2009 at 7:40 AM, fatu fab...@gmail.com wrote: ...Another question for now :-) Does it work for views as well? It should. Views are treated just like static XHTML files... a source of NodeSeq Many thanks. Fabio On 21 Mag, 15:38, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.organd it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is
[Lift] Re: how to serve html fragments
Okay... checked in a change that removes the ?...? XML header as well On Thu, Jun 4, 2009 at 6:57 AM, David Pollak feeder.of.the.be...@gmail.comwrote: On Thu, Jun 4, 2009 at 12:10 AM, fatu fab...@gmail.com wrote: Yes it does indeed. Sorry, I was getting confused by the fact that Firefox still doesn't like the fragment but it happens both when using a view and when using a template + snippet. The DOCTYPE is indeed missing in both cases when S.skipDocType is on, I guess what's still causing trouble is the fact that the XML declaration is still there. I think I can remember seeing somewhere (group? blogs?) another flag that, when turned on, would skip the XML declaration but I can't find it right now. Is there really such a thing or did I only dream about it? Lemme see what I can do. Thanks. On 3 Giu, 17:57, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, Jun 3, 2009 at 7:40 AM, fatu fab...@gmail.com wrote: ...Another question for now :-) Does it work for views as well? It should. Views are treated just like static XHTML files... a source of NodeSeq Many thanks. Fabio On 21 Mag, 15:38, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.organd it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus
[Lift] Re: how to serve html fragments
Have you pushed this change? Its not showing on github? Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
On Thu, Jun 4, 2009 at 10:04 AM, Timothy Perrett timo...@getintheloop.euwrote: Have you pushed this change? Its not showing on github? I pushed, but forgot to commit... :-) That's me, I just can't commit. All committed and pushed. Cheers, Tim On 04/06/2009 17:33, David Pollak feeder.of.the.be...@gmail.com wrote: Okay... checked in a change that removes the ?...? XML header as well -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
...Another question for now :-) Does it work for views as well? Many thanks. Fabio On 21 Mag, 15:38, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response
[Lift] Re: how to serve html fragments
On Wed, Jun 3, 2009 at 7:40 AM, fatu fab...@gmail.com wrote: ...Another question for now :-) Does it work for views as well? It should. Views are treated just like static XHTML files... a source of NodeSeq Many thanks. Fabio On 21 Mag, 15:38, David Pollak feeder.of.the.be...@gmail.com wrote: On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into
[Lift] Re: how to serve html fragments
Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically.
[Lift] Re: how to serve html fragments
Thanks guys for following up on this. It's a great help here too. George On May 21, 5:42 am, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george -- Lift, the simply functional web
[Lift] Re: how to serve html fragments
On Thu, May 21, 2009 at 12:27 AM, fatu fab...@gmail.com wrote: Right, didn't think about that alternative. Thanks and best compliments to you and all the active Lift community for this superb Scala framework! I really think (and hope) it's going to have a big impact and a tremendous popularity rise in the next months, especially with more forthcoming books and articles spreading the word. We ask two things: build cool apps in Lift and be part of this community, asking and answering questions. Thanks! On 21 Mag, 06:42, David Pollak feeder.of.the.be...@gmail.com wrote: On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
[Lift] Re: how to serve html fragments
Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here:http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here:http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here:http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
Neat! Not sure how it is that we have no come across this need before! Lol. Cheers, Tim On 20/05/2009 15:05, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org http://scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here:http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: how to serve html fragments
On Wed, May 20, 2009 at 8:38 PM, fatu fab...@gmail.com wrote: Hi David, yes it will do, thank you so much for such a lightning-fast development in reply! I'm only thinking about a case that is probably much more of an exception than a rule, i.e. when the snippet dynamically decides if it needs to generate a full page or a fragment (which is not a very good design anyway IMHO), for example based on some info passed. But even in that case the snippet will know that and will be able to set S.skipDocType = true accordingly, so it should be perfectly fine. Plus it won't be difficult at all to make the processing diverge in the 2 cases by using URL rewrites, redirecting it to a different template / snippet depending on parameters or URL structure, which is probably a better design too. You could also pass a header flag from your AJAX call. If the header's set, you don't do the boilerplate surround that'll include all the html, head and body tags. Anyway, enjoy and thanks for the use case. Party on. Again many thanks everyone and David especially! On May 20, 4:05 pm, David Pollak feeder.of.the.be...@gmail.com wrote: I'm about to commit S.skipDocType = true | false. If you set it to true, the !DOCTYPE .../ will be omitted from the response page. This will allow your AJAX fragements to pull parts of pages from the server. Note that someplace in your snippets, you'll have to set S.skipDocType = true. Does this address your issue? On Wed, May 20, 2009 at 5:13 AM, fatu fab...@gmail.com wrote: Hi Marius, as I understand them, Jx classes help in generating JS that can itself generate DOM at the client. Am I wrong? I'd really like to serve back an HTML fragment built by using the normal Lift template pipeline (so including surround bind). Is that possible? Thanks On 20 Mag, 13:16, marius d. marius.dan...@gmail.com wrote: As I understood you want to make an Ajax request and serve back a Document Fragment. If so please also take a look at Jx stuff. We discuss Jx classes in a fairly amount of details in the lift book. Br's, Marius On May 20, 9:32 am, fatu fab...@gmail.com wrote: Timothy, thanks for the links, I found them useful and I find your blog in general very interesting. Came across scala-blogs.org and it looks quite promising as well. I knew bind already from the Exploring Lift book which I pull from git, build with Lyx and keep at hand regularly. In the doctype post, though, I couldn't find a way to specify no doctype which I think is necessary to serve a fragment; plus I couldn't find any other easy out-of-the-box way to do it. Shouldn't this use case (serving fragments), which I think is quite common, be better / more easily supported by the framework? Can someone post an example of how to do it with raw response handling in the meanwhile? Thanks anybody. Fabio On 26 Apr, 21:49, Timothy Perrett timo...@getintheloop.eu wrote: George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets:http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads anhtmlfragmentand puts it into the dom using prototype. i have set up a template which contains thefragmentat src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPEhtmlPUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the rawhtmlwithout meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate thefragment dynamically. i would also prefer to have a separatehtmltemplate file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- Lift, the simply functional web framework http://liftweb.net Beginning Scala
[Lift] Re: how to serve html fragments
George, To tell lift what doctype you want to use see my blog post here: http://is.gd/uJ4L Also, you'll want to read another one of my posts in which I discuss the bind(...) method and how you can stop putting markup into your snippets: http://is.gd/sfyT Cheers, Tim On Apr 26, 1:02 pm, george geo...@mattandgeorge.com wrote: hello all, hopefully someone can help me out here. i am trying to port some simple ajax stuff over to lift from a rails app. basically it just loads an html fragment and puts it into the dom using prototype. i have set up a template which contains the fragment at src/main/ webapp/fragment.html ulliitem/li/ul then i made the page available using the SiteMap and all seems good, but here comes the problem the lift response adds the xml declaration and doctype, one of which seems to cause prototype some problems ?xml version=1.0 encoding=UTF-8? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; ulliitem/li/ul so the question is, how can i make lift send back the raw html without meddling with it? i have tried out using ResourceServer to serve it statically which works, but this wouldn't allow me to generate the fragment dynamically. i would also prefer to have a separate html template file rather than embedding the markup code in a snippet. any thoughts gratefully received.. george --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---