app1.scala
changeset 5 1280309e6bfc
child 6 4c40d4b2d01c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app1.scala	Mon Sep 24 20:51:17 2012 +0100
@@ -0,0 +1,28 @@
+object Application extends Controller {
+
+  // presenting login form
+  val index = Action { request =>
+    
+    val form = """<form method="post"> 
+                Login: <input type="text" name="login"><br>
+                Password: <input type="password" name="password"><br>
+                <input type="submit"></form>"""
+
+    Ok(form).as(HTML)
+  }  
+
+  
+  // processing the received login data
+  val receive = Action { request =>
+    
+    val form_data = Form (tuple ("login" -> text, "password" -> text))
+
+    val (login, password) = form_data.bindFromRequest()(request).get 
+    
+    Ok("Received login: " + login + " and password: " + password)
+  }
+  
+}
+
+
+