Still got the same error. The source files are:
Form.scala:
package com.celestine.learninglift.snippet
import net.liftweb.http._
import S._
import net.liftweb.util._
import Helpers._
import scala.xml._
class Form {
def show(tag: NodeSeq): NodeSeq = {
var txtVal: String = ""
var radval: String = ""
var fileHolder: Box[FileParamHolder] = Empty
import java.awt.Color
val data = List(Color.RED, Color.BLACK, Color.GREEN)
val all = data.map(e => (e, e.toString)).toSeq
// val sel = data.keys.toList.toSeq
val radio = SHtml.selectObj(all, Empty, (v:Color) => {println
("Selected: Radio-" + v); v})
def process() = {
val okFile = fileHolder match {
case Full(FileParamHolder(_,mime,_,data)) => {
if(mime.startsWith("image/")) println("Image
type.\nMime: "+mime+"\nData: "+data.deepToString)
else if(mime.startsWith("application/"))
println("Application Type.\nMime: "+mime+"\nData: "+data.deepToString)
else println("Other type.\nMime: "+mime
+"\nData: "+data.deepToString)
true
}
case _ => false
}
true
}
bind("f", tag,
"txt" -> SHtml.text(txtVal, txtVal = _),
"lnk" -> SHtml.link("/next", () => println("Linked..."),
Text("lint to next")),
"chk" -> SHtml.checkbox(false, println(_)),
"pass" -> SHtml.password("", println(_)),
"ta" -> SHtml.textarea("Enter Text", println(_), "cols" -
> "80", "rows" -> "8"),
"rb" -> radio,
"up" -> SHtml.fileUpload(p => {fileHolder = Full(p)}),
"submit" -> SHtml.submit("submit", process)
)
}
}
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://
maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.celestine</groupId>
<artifactId>LearningLift</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>LearningLift</name>
<inceptionYear>2007</inceptionYear>
<properties>
<scala.version>2.7.5</scala.version>
<netbeans.hint.deploy.server>J2EE</netbeans.hint.deploy.server>
</properties>
<repositories>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-util</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-webkit</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-mapper</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>[6.1.6,)</version>
<scope>test</scope>
</dependency>
<!-- for LiftConsole -->
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-compiler</artifactId>
<version>${scala.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
</plugin>
<plugin>
<groupId>net.sf.alchim</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>compress</goal>
</goals>
</execution>
</executions>
<configuration>
<nosuffix>true</nosuffix>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<downloadSources>true</downloadSources>
<excludes>
<exclude>org.scala-lang:scala-library</exclude>
</excludes>
<classpathContainers>
<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</
classpathContainer>
</classpathContainers>
<projectnatures>
<java.lang.String>ch.epfl.lamp.sdt.core.scalanature</
java.lang.String>
<java.lang.String>org.eclipse.jdt.core.javanature</
java.lang.String>
</projectnatures>
<buildcommands>
<java.lang.String>ch.epfl.lamp.sdt.core.scalabuilder</
java.lang.String>
</buildcommands>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Index.html:
<lift:surround with="default" at="content">
<head><title>My first Lift! Current page "<lift:Menu.title/
>"</title></head>
<!--h2>Welcome to your project!</h2>
<p><lift:helloWorld.howdy /></p-->
<lift:Hello.greet>
<salute:hello eager_eval="true"/>
<salute:goodbye/>
</lift:Hello.greet><br/>
<lift:Form.show form="post" multipart="true">
Textbox <f:txt/><br/>
Link <f:lnk/><br/>
Checkbox <f:chk/><br/>
Password <f:pass/><br/>
textarea <f:ta/><br/>
Radio Buttons <f:rb/><br/>
Upload <f:up/><br/>
<f:submit/>
</lift:Form.show>
</lift:surround>
next.html:
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body>
<strong>Link successful</strong>
</body>
</html>
Hope it helps you help me
On Aug 25, 11:10 am, "marius d." <[email protected]> wrote:
> What Scala & lift version are you using ? Are you compiling with one
> scala version and use a different one at runtime?
>
> The error also looks like an invalid xml provided. Can you paste you
> xml template where you have the snippet ?
>
> Br's,
> Marius
>
> On Aug 25, 12:45 pm, celestocalculus <[email protected]>
> wrote:
>
> > I really love the Lift framework. It handles a lot of things for you
> > and it makes web programming really easy!
>
> > I was reading "The Definitive guide to Lift" though I just finished
> > the SiteMap chapter (ie chapter 5), I tried to link to another URL, a
> > html document I created in the same directory but I kept getting the
> > following error:
>
> > Exception occured while processing /next
>
> > Message: java.lang.IllegalArgumentException: line 5 does not exist
> > scala.io.Source.getLine(Source.scala:280)
> > scala.io.Source.report(Source.scala:368)
> > scala.io.Source.reportError(Source.scala:355)
> > scala.io.Source.reportError(Source.scala:344)
> > scala.xml.parsing.MarkupParser$class.reportSyntaxError
> > (MarkupParser.scala:1113)
> > ...
>
> > Where next.html is the name of the html document.
>
> > The Html tag that links is:
> > ...
> > Link <f:link/>
> > ...
>
> > The code that controls the snippet is:
> > ...
> > bind("f", tag,"link" -> SHtml.link("/next", () => println
> > ("Linked..."), Text("lint to next")),)
> > ...
>
> > Can anyone help me with this please? I'll also appreciate it with lots
> > of explanations and/or better ways of linking URLs with and without
> > maintaining state.
>
> > Thanks in advance.
e.
>
> > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---