Java-Business-Application/C2/Database-and-validation/Khasi
From Script | Spoken-Tutorial
Revision as of 17:24, 24 May 2017 by Hezekiah2016 (Talk | contribs)
Time | Narration |
00:01 | Pdiang sngewbha sha spoken-tutorial halor Database and validation. |
00:06 | Ha kane ka tutorial, ngin pule ban: |
00:08 | ïatrei lang bad ka database bad |
00:10 | Validate ïaki fields. |
00:12 | Hangne ngi pyndonkam ka :Ubuntu Version 12.04 |
00:15 | Netbeans IDE 7.3 |
00:19 | JDK 1.7 |
00:21 | Firefox web-browser 21.0 |
00:24 | Phi lah ban pyndonkam uno uno u web-browser uba phi kwah. |
00:28 | Ban bud ïakane ka tutorial, phi dei ban don ka jingtip ïaka: |
00:31 | Ki Basics jong Java Servlets bad JSPs |
00:35 | Ban connect sha ka MySQL Database naka Netbeans IDE |
00:39 | Shna ïaka database bad tables |
00:42 | Lada em, na bynta ki tutorial ba kum kane leit shaka website jong ngi. |
00:47 | Mynta, to ngin leit sha Netbeans IDE. |
00:52 | Nga la sdang ïaka MySQL server. |
00:55 | Nga lahdep shna ïaka database ka ba kyrteng library. |
01:00 | Nga lahdep shna ïaka table ka ba kyrteng ka Users. |
01:04 | Nga lahdep thep lypa katto katne ki value ha kane ka table. |
01:08 | Ngan pyni ïaki mynta. |
01:10 | Na bynta kata, right click ha Users bad click ha View Data. |
01:15 | Click u jingshon Output uba ha trai. |
01:19 | Ngi lah ban iohi hangne baki don 15 users . |
01:23 | Ngi lah ban iohi ïaka FirstName, Surname, Age, Gender, email, Username bad Password. |
01:31 | Mynta, to ngin load ïaka JDBC driver kata Java Database Connectivity Driver. |
01:39 | Na bynta kata, click ha u Projects tab. |
01:42 | Right-click ha Libraries bad click ha Add Library. |
01:46 | Nangta click ha u MySQL JDBC Driver. |
01:50 | Bad click ha Add Library. |
01:53 | Kane kan load ïa u JDBC Driver. |
01:56 | To ngin run iaka Project kumba ngi lah leh hashwa. |
02:00 | Mynta, type iaka User Name kum "arya" bad Password kum "arya123*". |
02:06 | Nangta click ha Sign In. |
02:08 | Ngi lah ban ioh ïaka Success Greeting Page. |
02:12 | Click ha here ban logout. |
02:15 | Mynta, to ngin leit phai pat sha ka IDE. |
02:17 | NGin leit sha ka GreetingServlet dot java. |
02:21 | Wan sha ka doPost method. |
02:23 | Hakaba nyngkong, ngi ioh ïaka username bad password naka request pyndonkam ka getParameter() method. |
02:31 | KaBa bud, Ngin peit ia u code na bynta ka JDBC connection. |
02:35 | Nyngkong, ngi la buhdak sdang ïaka Connection object, PreparedStatement object bad ResultSet object sha null. |
02:44 | Nangta ngi register ïa u driver haka program jong ngi. |
02:48 | Nangta ngi shna ïaka connection sha ka database. |
02:52 | Nangta, ngi execute ïaka prepareStatement method haka Connection object. |
02:58 | Ngi ai ïaka query ban ioh ïa ki user detail naka Users table. |
03:03 | Ngi peit la ka username bad password ki long ne em katkum kiba la pyndap ha ka form. |
03:09 | Hangne, U dak jingkylli u thew ïa kawei pa kawei ka field haka database. |
03:15 | Ban thep ki value haka jaka u dak jingkylli, ngi pyntreikam ïaka setString() method. |
03:22 | Ngi leh ïa kane dakaba pyndonkam ka PreparedStatement object. |
03:26 | Nangta ngi pyntreikam ïaka executeQuery method ha ka object Prepared statement. |
03:33 | NGi buh ïa kaba mih ha ka object ResultSet. |
03:37 | Na bynta ka jing login bajop, ngi pyni ïaka successGreeting page. |
03:43 | Na bynta kane, ngi pyndonkam ka RequestDispatcher interface. |
03:48 | Ngi pyndonkam ka method getRequestDispatcher() haka request ban ioh ïaka object RequestDispatcher. |
03:56 | Nangta ngi pynmih ïaka method forward() haka object RequestDispatcher. |
04:02 | Ha kane ka rukom, ngi forward sha ka successGreeting dot jsp. |
04:07 | Mynta leit phai biang sha ki slides. |
04:10 | To ngin pule khyndiat shaphang u RequestDispatcher interface. |
04:15 | u ne u interface u ai ïa ka jingpynlah ban phah ïaka request sha kawei pat ka resource. |
04:22 | Ka resource ka lah ban long ka html, servlet lane jsp. |
04:26 | Mynta, to ngin phai pat sha ka IDE. |
04:29 | To ngin wan sha successGreeting dot'jsp.' |
04:33 | Hangne, ngi la pyni ïa ka success message You have successfully logged in. |
04:38 | Mynta, phai biang sha u browser. |
04:41 | Type ka username bad password kaba ngi khlem shym la kynthup haka database. |
04:47 | Te, to ngan type abc kum ka username bad abc123* kum ka password. |
04:56 | Nangta click ha Sign In. |
04:59 | Ngi lah ban iohi ba ngi ioh ïaka error message ha kajuh hi ka page. |
05:03 | "Please correct the following errors!!! Invalid username or password" . |
05:09 | Mynta, to ngin peit ïa u code Na bynta kane. |
05:12 | TE, phai biang sha ka IDE. |
05:14 | leit sha GreetingServlet dot java. |
05:17 | lada ka validation ka bakla te ngin sa iohi ïaka error message. |
05:22 | Nyngkong, ngi lahdep ban buhdak sdang ïa ka List jong ki errorMsgs. |
05:27 | Ngi ai ïaki variable errorMsgs hapoh ka request scope pyndonkam ka setAttribute method. |
05:35 | Hangne, ka errorMsgs kadei ka kyrteng jong ka attribute. |
05:39 | NGi lah buhdak sdang ïa u String variable id sha null. |
05:44 | Nangta, ngi peit lada u user lah don ne em haka database. |
05:48 | lada hooid, ngi thep ïa ki value ha u variable id. |
05:53 | Lymda kumta, ngi thep ïa ka error "Invalid username or password" sha ka errorMsgs list. |
06:00 | Lada ka errorMsgs list kam long thylli te ngi pyni ïaka error messages haka index dot jsp. |
06:09 | te, ngi donkam ban pynphai pat sha ka index dot jsp. |
06:13 | Ngi lahdep iohi lypa kumno ban pynphai pat sha kawei ka page pyndonkam ka RequestDispatcher. |
06:20 | Peit thuh ba ngi la kynthup lang ïa une u code hapoh ka try catch block ban pynbiang ïaka exception scenario. |
06:27 | Mynta, ngin peit kumno ban ioh ïaki variable errorMsgs ha ka index dot jsp. |
06:34 | Nyngkong, ngi ioh shwa ïa ka value jong ka attribute "errorMsgs". |
06:38 | La leh ïa kane dakaba pyndonkam ka getAttribute method haka request. |
06:44 | Peit thuh ba ngi la thep lang ïaka Java code hapoh ki tag basdang kaba long less than sign percentage sign bad u tag ba kut percentage sign and greater than sign. |
06:57 | Kane ka block ïa u code ba tip kum scriptlet. |
07:02 | U kynthup ïa u Java code uba pyntreikam manla ka por ba la pyntreikam ïa u JSP . |
07:08 | Lada ka value jong ki errorMsgs kim dei null te ngi pyni ïa kane ka message. |
07:15 | "Please correct the following errors". |
07:18 | Nangta ngi bthah ba kan ïaid biang ïaka list jong ki errorMsgs baroh. |
07:23 | Nangta, ngi pynpaw ïaka error messages kum ka list. |
07:27 | Hakane ka rukom ngi pynpaw ïaki error messages haka index dot jsp. |
07:32 | Mynta, to ngin peit kumno ban pynrung u user sha ka database. |
07:37 | Shwa ban pynrung ïa u user sha ka database, ngi donkam ban shna ïa ka model na bynta ka User table. |
07:44 | Mynta, to ngin peit kaei ka model. |
07:48 | KA model : Ka thew ïaki rukom shong ki logical structure jong ki data haka software application. |
07:55 | KA Java class ryngkat attributes bad setters bad getters na bynta jong ki. |
08:00 | Ha kane ka rukom, ngi lah ban shim ïaka model kum kawei haka jaka jong ki attributes ba marwei marwei. |
08:07 | Mynta, Phai biang sha ka Netbeans IDE. |
08:11 | Nga lahdep shna lypa ïaka model User dot java. |
08:16 | Peit thuh ba ngi la shna ïa kane ka Java class hapoh ka package org dot spokentutorial dot model. |
08:24 | Ngi don ïaki attribute harum - firstName, surname, age, gender, email, username bad password. |
08:33 | Ngi lah buhdak sdang ïaki ha ki value ba thylli. |
08:37 | Nangta ngi don ka parameterized constructor. |
08:41 | NGi don ruh ïa u default constructor. |
08:44 | Ngi batai ïaka getFirstName method. |
08:47 | Ngi la batai ruh ïaka setFirstName method. |
08:51 | Kumjuh ruh, ngi la batai ïaka set bad get methods ha kawei pa kawei ka attributes. |
08:57 | Wanphai pat sha u browser. |
08:59 | Mynta, to ngin click ha u link here ban register. |
09:03 | Type ha baroh ki fields haka Registration page. |
09:07 | Nangta click ha Add User. |
09:10 | Ngi ïoh ïaka Add User Success page. |
09:14 | Ngi ioh ïaka message: "Your request to add harshita was successful". |
09:20 | Hangne harshita Kadei ka username kaba ngi lah ai. |
09:24 | Mynta, to ngin peit kumno la leh ïa kane. |
09:28 | te, phaibiang sha ka IDE. |
09:30 | Leit sha AddUserServlet dot java. |
09:35 | Ki synjam ki ïasyriem bad kito kiba ngi la leh ha ka GreetingServlet dot java. |
09:40 | Nyngkong, ngi ioh ïaka form parameters pyndonkam ka getParameter method. |
09:46 | Ngi buhdak sdang ïaki variable user kum instance jong u User model with individual attributes. |
09:53 | Ngi buh ïaki variable user hapoh ka request scope pyndonkam ka setAttribute method. |
10:01 | Lada kam don ka jingbakla haka por ba pyndap ïaka form, ngi execute ïaka query ban thep ïaki values shapoh ka Users table. |
10:10 | Nangta ngi phah pat sha ka successUser page. |
10:15 | Mynta, to ngin wan shaka successUser dot jsp. |
10:19 | Nyngkong, ngi la import ka User dot java. |
10:24 | Kane ka lain jong ki code la khot directive haka JSP. |
10:28 | KA JSP directive ka sdang da ki tag ba sdang - 'less than sign percentage sign and at the rate sign' bad ka kut daki tag ba khang - 'percentage sign and greater than sign'. |
10:42 | Kane kadei ka page directive. |
10:45 | Ka page directive ka kynthup ïaka list jong baroh ki packages bala import. |
10:50 | NGi ioh ïaka value attribute jong ki user bad buh ïaki kum ki User object. |
10:57 | Nangta, ngi don ïaka success message hangne. |
11:00 | Hangne, ngi lah sei ïaka Username. |
11:04 | Ngi la pyndonkam ïa ka getUsername() method ha ka request object. |
11:09 | Ngi la leh ïa kane dakaba pyndonkam ki scriptlet tags. |
11:12 | Mynta , to ngin wanphai biang sha u browser. |
11:15 | Ngin pyrshang ban pynrung ïa u user uba la don lypa haka database. |
11:20 | Te, ngan pyrshang ban pynrung biang harshita. |
11:24 | Ngi lah ban iohi ba ngi ioh ïaka error message "Please correct the following errors!!!! Duplicate entry 'harshita' for key 'UserName'. |
11:33 | Mynta, to ngin register na bynta u user sa shisien. |
11:37 | Hangne, nga pyndap ïaka form mynta. |
11:40 | Nga la shna iaka Age field kaba bakla. |
11:44 | Nga la type ab haka jaka jong u number uba dei. |
11:48 | Mynta, click ha Add User. |
11:51 | Ngi iohi, ba ngi ioh ia ka error message- "The age must be a positive integer". |
11:57 | Mynta, to ngin peit kumno la leh ïakane. |
12:00 | Phai pat sha ka IDE. |
12:03 | Plie ïaka AddUserServlet dot java. |
12:08 | Hangne ruh, ngi la shna ïaka list na bynta ki errorMsgs. |
12:11 | Nangta ngi buh ki variable errorMsgs shapoh jong ka request scope pyndonkam ka setAttribute method. |
12:18 | Nangta, ngi la pynbna ïaka ageUser jong ka type integer bad ngi la buh ïaka dak sdang sha -1 (minus one). |
12:26 | Hapoh jong u try catch block, ngi la pyndonkam ka parseInt method. |
12:31 | Kane kan pynphai ïa u integer, bala ai ïa u string representation jong ki number kum ka input. |
12:37 | Te, hangne ngi lah ban pynshisha ba ka age field ka kynthup ïa u dak jingkheiñ badei. |
12:44 | Lada ka jingpynshisha ka bakla te ngi thep ïaka error message sha ka errorMsgs list. |
12:51 | The age Must be a positive integer. |
12:54 | Kumjuh ruh, ngi dei ban pynshisha ïa baroh ki fields ba kin don ïaki data ba dei. |
13:01 | Lada ka errorMsgs kam long thylli the ngin pyni ïaka errorMsgs ha ka addUser dot jsp hi. |
13:09 | Ngi lahdep peit kumno ban leh ïa kane dakaba pyndonkam u RequestDispatcher. |
13:15 | Mynta, to ngin wan sha ka addUser dot jsp. |
13:19 | Hangne ruh, nyngkong ngi dei ban import shwa ïa u User dot java. |
13:24 | Hapoh ki scriptlet tags, ngi la shna ïaka object ka rukom jong User. |
13:31 | Nangta ngi ioh ïa ka value jong ka attribute errorMsgs pyndonkam ka getAttribute method. |
13:38 | ngi peit lada kane ka value ka ïa ryngkat ne em bad u null. |
13:43 | Lada kam ïa ryngkat bad u null te ngi pyni ïaka error message kumba ngi la leh na bynta ka index dot jsp. |
13:51 | Lada em, ngin ioh ïaka value jong ka attribute user na ka request pyndonkam ka 'User' model. |
13:59 | Te ngi ioh ïaka form. |
14:01 | Ka form tag ka don ka action kum AddUserServlet bad method kum POST. |
14:07 | Ka Jaka ba nyngkong kadei ka First Name jong input type kum text , name kum firstName bad value kum user dot getFirstName. |
14:18 | Hangne, ngi la buh dak sdang ïaka value jong ka firstName sha empty string. |
14:24 | kumjuh ruh, phi dei ban leh naka bynta kiwei ruh ki fields. |
14:28 | Ngi don ruh u jingshon submit bad value kum Add User. |
14:33 | Kumne ngi leh ban pynshisha ïa ki fields hakaaddUser.jsp. |
14:38 | Phi lah ban pyrshang ïaki errors bapher bapher haka "addUser" page. |
14:42 | Mynta to ngin peit lada lah thep ne em ïaka user harshita sha ka database. |
14:49 | Te, wan biang sha ka Users table. Ngi lah ban iohi ba ïaka harshita la thep sha ka database. |
14:56 | Ha kane ka tutorial, ngi la pule ban: |
14:58 | Database connectivity bad |
15:00 | Field validation. |
15:02 | Ban tip shuh shaphang ka spoken tutorial project, Peit ïaka video badon haka link harum. |
15:07 | Ka batai lyngkot ïaka Spoken Tutorial project. |
15:11 | Lada phim don ka bandwidth ba biang, phi lah ban download bad peit ïaka. |
15:15 | Ka Spoken Tutorial Project team: |
15:17 | Ka pynlong workshops dakaba pyndonkam ki spoken tutorials. |
15:20 | Ka ai certificates sha kito kiba pass ïaka on-line test. |
15:23 | Ban tip kham bniah, sngewbha thoh sha: contact@spoken-tutorial.org |
15:29 | Spoken Tutorial project kadei shi bynta jong ka ‘‘‘Talk to a Teacher project. |
15:32 | La kyrshan ïaka daka National Mission on Education Lyngba ka ICT, MHRD, Sorkar India. |
15:38 | Khambun ka jingtip halor kane ka mission kadon ha ka :http://spoken-tutorial.org/NMEICT-Intro |
15:48 | ïaka Library Management System la noh synniang da ka software MNC ba pawkhmat lyngba ka programme "Corporate Social Responsibility" jong ki. |
15:57 | Ki la pynkhamti ruh ïaka content naka bynta kane ka spoken tutorial. |
16:02 | ïa kane ka script la pynkylla sha ka ktien Khasi da I Hezekiah Lyngdoh na Shillong. Khublei ba phi la ïasnohlang. |