Thanks David. But this seems not work as wished. It will meet some
error:

[INFO] Compiling 1 source files to /home/daiwhea/myworks/java/
liftonscala/MapperBBS/target/classes
/home/daiwhea/myworks/java/liftonscala/MapperBBS/src/main/scala/com/
vapee/main/snippet/GuestBook.scala:60: error: forward reference
extends over definition of variable localNote
      localNote.save
      ^
one error found
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR



Is there any error I made? Below is part of the GuestBook.scala for
list snippet:

  def list(html: NodeSeq): NodeSeq = {
    toShow.flatMap(item => {
        curListNote = item
        bind("item", html,
          "title" -> item.title,
          "email" -> item.email,
          "content" -> item.content,
          "reply" -> getReplyContent(item)
        )
      }
    )
  }

  def replyNote(html: NodeSeq): NodeSeq = {
    def doReply() = {
      localNote.save
    }

    var localNote = curListNote

    bind("note", html,
      "replyContent" -> SHtml.textarea(localNote.replyContent,
                                       localNote.replyContent(_)),
      "submit" -> SHtml.submit("Reply", doReply)
    )
  }

  private def toShow = GuestNote.findAll()

  var curListNote: GuestNote = _

  private def getReplyContent(item: GuestNote) = {
    if (item.repliedByAdmin == 0) {
      <div><p>Not replied by admin</p><lift:embed what="/templates-
hidden/gbook/replyForm" /></div>
    }
    else
      <div><p>{"Replied by admin at: "+item.replyTime}</p><lift:embed
what="/templates-hidden/gbook/replyForm" /></div>
  }

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.


Reply via email to