Hi,
I am new to Lift (and Scala) and need help with dispatching/redirecting to a
page after processing a form.
My problem: I get a "The Requested URL /search was not found on this server"
error message although the page "search.html" does exist.
When adding the page "search.html" to the LiftRules-SiteMap, then the page does
exist!
So is there any need to register HTML pages? I hope not!
This is my HTML fragment:
<lift:surround with="default" at="content">
<h3 class="alt" >Search
<lift:HelloWorld.search form="POST">
<entry:searchfield/>
<entry:submit/>
</lift:HelloWorld.search>
</h3>
</lift:surround>
And this is the corresponding Scala code:
class HelloWorld extends StatefulSnippet {
override def dispatch:DispatchIt = {
case "search" => search _
}
def search(xhtml : NodeSeq) : NodeSeq = {
object searchExpression extends RequestVar("")
def processSearch () {
if (searchExpression.isEmpty) {
S.error("Must not be empty!")
}
else {
S.notice("Value was: " + searchExpression)
redirectTo("/search")
}
}
bind("entry", xhtml,
"searchfield" -> SHtml.text(searchExpression.is, searchExpression(_)),
"submit" -> SHtml.submit("Suche", processSearch)
)
}
}
Why cannot my "/search" page be found?
Thanks for help!
Hannes
Hannes Restel | Fraunhofer Institut für Software- und Systemtechnik
Sichere Business IT-Infrastrukuren, Studentischer Mitarbeiter
Steinplatz 2, 10623 Berlin, Germany
Telefon: +49 (0)30/24 306-324
mailto:[email protected]
http://www.isst.fraunhofer.de
--
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.