[Lift] Re: JSON Reponses

2009-12-03 Thread Daniel Nelson
Hi Matt,

I'm pretty new/novice myself, but I believe you do this through View
instead of Snippet.

Don't forget to add the specific View page to Sitemap otherwise it
won't be accessible when you call it.

Hope this is accurate / helpful.

Dan

On Dec 3, 11:06 am, deadfolk deadf...@gmail.com wrote:
 Hi all,

 I'm still at the evaluation stage of Lift, so please forgive my
 ignorance, but I cannot figure out how to render any non-XML reponses.

 I'm looking to create a simple web service which can send reponses
 back in either XML or JSON.  I have the XML side covered, but I can't
 figure out how to send a JSON response back.  Snippets take a NodeSeq
 and return a NodeSeq, so unless I'm missing something here, they are
 only good for XML.

 I've found various posts on JSON, but they all seem to relate to forms
 and AJAX, whereas all I really want to be able to do is render JSON
 instead of XML.

 Any pointers greatly appreciated,

 Matt

--

You received this message because you are subscribed to the Google Groups 
Lift group.
To post to this group, send email to lift...@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: Ajax example from the book

2009-09-14 Thread Daniel Nelson

If you're referring to the Exploring Lift book, have a look at Section
3.11.1 Binding Values in Snippets where it explains bind. (I'm new
to Lift myself and hopefully not leading you astray.)

1. myFunc's html parameter is fed automatically by the HTML Lift
Template.  In the follow example, everything between
lift:SomeClass.myFunc and /lift:SomeClass.myFunc is passed to
myFunc.

lift:surround with=default at=content
h2Hello World/h2
lift:SomeClass.myFunc form=POST
p Some Text hello:description //p
hello:button /
/lift:SomeClass.myFunc
/lift:surround


2. hello is a prefix for referring to template elements by name. The
HTML Lift template should have some like hello:button / which will
get replaced by the evaluation after - within bind().

3. I'm not sure what you mean How does the div work.


On Sep 13, 10:24 pm, jack jack.wid...@gmail.com wrote:
 Could somebody please explain to me how this example from the book
 works.

  def myFunc(html:NodeSeq):NodeSeq  = {
         bind(hello,html,button -
          ajaxButton(Text(Press me),
                     { () =
                       println(Got an Ajax call.)
                      SetHtml(my-div, Text(That's it))
                    })
        )
   }

 In particular, what do I pass in as the html parameter?
 What is 'hello'?
 How does the div work?

 I don't understand 'bind'.

--~--~-~--~~~---~--~~
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: Menu direct link to pdf to download

2009-08-31 Thread Daniel Nelson

I'm not sure about the right way to do this in Lift, but an external
menu link serves it up (with webapp as the base directory).

Menu(Loc(FileDownload, ExtLink(content/StartingWithLift.pdf) ,
FileDownload)) ::


On Aug 29, 9:11 pm, Jim Myers myer...@gmail.com wrote:
 I'm trying to put a link in a menu to directly download a PDF.

 Menu(Loc(DH6, (current/pdf/DH6.pdf ::  :: Nil) - true, DH6 -
 test PDF)) ::

 I get the message:
 The requested page was not defined in your SiteMap, so access was
 blocked.

 Is this possible?  If so, what's the secret?

--~--~-~--~~~---~--~~
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] (beginner question) Liftweb View folder

2009-08-27 Thread Daniel Nelson
Hello,

*Problem*
I'm new to Lift/Scala and trying to understand/experiment with Lift's View
folder.  I've not gotten past a 404 error on the browser (as it relates to
the View folder; templates render fine).

*Background/Environment*
I've been reading Exploring Lift (~Section 3.7) along with What's the
'View' folder for? from http://wiki.liftweb.net/index.php/FAQ.

Following are the URL and corresponding class (in the View Folder and
adapted from http://github.com/dpp/liftweb/...
herehttp://github.com/dpp/liftweb/blob/be8f0c4ea9eb0f145e0452cc6100943b7f4888cf/sites/example/src/main/scala/net/liftweb/example/view/XmlFun.scala).


The server is maven/jetty.

I'm struggling to find other reading materials/examples which highlight my
error(s); any help is appreciated.  Thanks!  Dan

~~~

URL: http://localhost:8080/XmlFun/index

package org.delreino.simplyLift.view

import _root_.scala.xml.{Text, Node, NodeSeq}
import _root_.net.liftweb.http._
import S._
import _root_.net.liftweb.util._

class XmlFun extends LiftView {
def dispatch = Map(index - render _)
def render = {
println (XmlFun)
Full(
lift:surround with=default at=content
pXMLFun/p
/lift:surround)
}
}

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