PDA

View Full Version : How to Login with JSP ?



nikolayLevin
9 Jul 2010, 12:37 AM
hi everyone,
i am new on jsp and sencha, i would like to make a login script for iphones. I designed the form but i dont know how to make database operations. How can i get the username and password from login form and send it to .jsp file to check user is valid or not ?

evant
9 Jul 2010, 12:43 AM
This is more of a server side question. Essentially you want to post the form to the server. Then you'd read in the username/password like you would with a normal form post and do your checks against the db.

nikolayLevin
9 Jul 2010, 2:38 AM
Ext.setup({
onReady: function(){
var formBase = {
scrool: 'vertical',

items: [{
xtype: 'fieldset',
title: 'Login',
defaults : {
required : true,
labelAlign: 'left',
},

items : [
{
xtype: 'textfield',
name: 'name',
placeholder: 'Kullanici Adi / UserName'
},{
xtype: 'passwordfield',
name: 'password',
placeholder: 'Sifre / Password'
},
{
xtype: 'select',
name : 'language',
label: 'Dil/Language',
options: [
{text: 'Turkce', value: 'turkish'},
{text: 'English', value: 'english'}
]
}
]
}
],
dockedItems :[{
xtype : 'toolbar',
dock : 'bottom',
items : [
{
text: 'Login',
ui:'action',
handler : function(){
alert("login succeded");
//I need the code will be placed here

}
},
{
text: 'Reset',
handler: function(){
form.reset();
}
}
]
}]




};
if (Ext.platform.isAndroidOS) {
formBase.items.unshift({
xtype: 'component',
styleHtmlContent: true,
html: '<span style="color: red">Forms on Android are currently under development. We are working hard to improve this in upcoming releases.</span>'
});
}

if (Ext.platform.isPhone) {
formBase.fullscreen = true;
} else {
Ext.apply(formBase, {
autoRender: true,
floating: true,
modal: true,
centered: true,
hideOnMaskTap: false,
height: 385,
width: 480,


});
}
var form = new Ext.form.FormPanel(formBase);

form.show();

}
}
)
this is my code and i dont know how to post name and password data to loginUser.jsp file. I d like to send name and password to loginUser.jsp when the user click login button, what changes i need to do ?

TommyMaintz
13 Jul 2010, 11:31 AM
You can use form.getValues() and pass them as params to an Ext.Ajax.request call.

nikolayLevin
13 Jul 2010, 10:25 PM
i have tried to use form.getValues() but didnt work, it sends parameters as null, then i tried to Ext.get() it also doesnt work.

jay@moduscreate.com
14 Jul 2010, 4:48 AM
I don't think "scrool" is a valid config option ;p)

nikolayLevin
15 Jul 2010, 12:00 AM
i am going to add more items into login form, thats why i used scrool option for the future :)