app1.scala
changeset 5 1280309e6bfc
child 6 4c40d4b2d01c
equal deleted inserted replaced
4:31ccabd34430 5:1280309e6bfc
       
     1 object Application extends Controller {
       
     2 
       
     3   // presenting login form
       
     4   val index = Action { request =>
       
     5     
       
     6     val form = """<form method="post"> 
       
     7                 Login: <input type="text" name="login"><br>
       
     8                 Password: <input type="password" name="password"><br>
       
     9                 <input type="submit"></form>"""
       
    10 
       
    11     Ok(form).as(HTML)
       
    12   }  
       
    13 
       
    14   
       
    15   // processing the received login data
       
    16   val receive = Action { request =>
       
    17     
       
    18     val form_data = Form (tuple ("login" -> text, "password" -> text))
       
    19 
       
    20     val (login, password) = form_data.bindFromRequest()(request).get 
       
    21     
       
    22     Ok("Received login: " + login + " and password: " + password)
       
    23   }
       
    24   
       
    25 }
       
    26 
       
    27 
       
    28