I am a total newbie trying to learn Scala and Lift. It is a near
certainty that my problem is a misunderstanding of something simple so
please don't assume that I have a clue.

My organization is performing a technology evaluation and the winning
technology will be used for an upcoming project. Scala/Lift is the
first technology to be evaluated.

As part of the evaluation, we are going to implement a handful of
small items in each technology so that we can evaluate them on factors
such as ease of learning and ease of modifying.

The first feature that we are going to start with is a simple comet
bit that reports the summary of the system server status - number of
servers that are up vs number that are down. Determining these two
numbers is hard but displaying them looks like it should be reasonably
easy - if I could understand it enough to make it work.

I'm starting with the comet example from section 9.5.2 of "Exploring Lift".

I have a block in my HTML file and I also have a class "ServerStatus".
The result is the error message at the end of this message (with the
arrow showing that srvstat is the unbound prefix).

What am I missing?

Thank you,

Donald

----- HTML snippet-----
    <lift:comet type="ServerStatus" name="Other">
        Servers up: <srvstat:up>don't know</srvstat:up>
        Servers down: <srvstat:down>don't know</srvstat:down>
    </lift:comet>

----- file ServerStatus.scala -----

package demo.helloworld.comet

import net.liftweb.http.CometActor
import net.liftweb.http.js.JsCmds.SetHtml
import java.util.Date

import xml.Text
import net.liftweb.util.{ActorPing, Full, Helpers}

class ServerStatus extends CometActor {
  override def defaultPrefix = Full("srvstat")

  def upCount: Int = 5
  def downCount: Int = 6

  def render = bind("up" -> upText)
  def upText = (<span id="up">
    {upCount}
  </span>)

  def downText = (<span id="down">
    {downCount}
  </span>)

  // schedule a ping every 10 seconds so we redraw
  val tickSpan: Helpers.TimeSpan = Helpers.intToTimeSpan(10000)
  ActorPing.schedule(this, Tick, tickSpan)

  override def lowPriority: PartialFunction[Any, Unit] = {
    case Tick => {
      println("Got tick " + new Date());
      partialUpdate(SetHtml("up", Text(upCount.toString)))
      partialUpdate(SetHtml("down", Text(downCount.toString)))
      // schedule an update in 10 seconds
      ActorPing.schedule(this, Tick, tickSpan)
    }
  }
}
case object Tick

----- Error Message -----
XML Parsing Error: prefix not bound to a namespace
Location: http://mcproto.translab.stsci.edu:8080/liftdemo/
Line Number 22, Column 23:        Servers down: <srvstat:down>don't
know</srvstat:down>
----------------------^
-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

Join the photo preservation advocacy Facebook group:
http://www.facebook.com/home.php?ref=logo#/group.php?gid=148274709288
-- 
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