I am a total newbie in Scala and Lift, I've been working with that for 2 months only, so I have a lot of trouble with some stuff. I've been reading simply lift and the definitive guide to lift, but I tried the methods to redirect to another page when pressing a button with no success.
Here's the code I have until now:
class BL_LOG001S {
object Log e开发者_如何学Pythonxtends Logger
var lang_id = 1//English
var ido = IDO_LOG001
var odo = ODO_LOG001
var usr = new User
var input_usr = DAO_LOGIN_USER_001.create
def init = {
Log.info("INIT 1: LANG_ID: "+lang_id)
lang_id = usr.lang_id
Log.info("INIT 2: LANG_ID: "+ lang_id)
}
def title = {
Log.info("TITLE: INIT END:")
<h2>{odo.body("title").toLabel(lang_id)}</h2>
<span>{usr.login_nm.toString}</span>
}
def login() = {
<table>
{odo.body("organization_nm").toTableElement(lang_id)}
{odo.body("login_nm").toTableElement(lang_id)}
{odo.body("password").toTableElement(lang_id)}
</table>
}
def transaction() = {
<table>
<tr>
<td><LOG001_1:submit><button>Login</button></LOG001_1:submit>
</td>
</tr>
</table>
}
def display(form: NodeSeq) = {
<lift:BL_LOG001.execute form="post" multipart="true">
{login}
{transaction}
</lift:BL_LOG001.execute>
}
def execute(form: NodeSeq) = {
doBind(form)
}
def checkAndLogin(): Unit = {
Log.info("Check: init: organization_nm = "+input_usr.organization_nm)
ido.body("organization_nm").setValue(input_usr.organization_nm)
ido.body("login_nm").setValue(input_usr.login_nm)
ido.body("password").setValue(input_usr.password)
usr.login(ido.body("organization_nm").getValue.toString,
ido.body("login_nm").getValue.toString,
ido.body("password").getValue.toString)
S.redirectTo("/AdminPage/ADM001")
}
def doBind(form: NodeSeq) = {
bind("LOG001_1", form,
"organization_nm" -> input_usr.organization_nm.toForm,
"login_nm" -> input_usr.login_nm.toForm,
"password" -> input_usr.password.toForm,
"submit" -> SHtml.submit("Login", checkAndLogin))
}
}
The method checkAndLogin has S.redirectTo, but it does not redirect to the page I need. What I need is to capture the organization and login name, and show them in the next page.
I'm sorry if I am asking something stupid. I would really appreciate any help. Thanks
have you tried method RedirectTo of object JsCmds? [doc of this here]
Maybe it helps you.
For future - for problems strictly connected to Lift framework I recommend to ask on Lift forum, where are all Lift experts and they are very helpful for every Lift developer, especially for newbies :)
good luck
精彩评论