https://script.spoken-tutorial.org/index.php?title=Java-Business-Application/C2/Servlet-Methods/English&feed=atom&action=history
Java-Business-Application/C2/Servlet-Methods/English - Revision history
2024-03-29T09:08:20Z
Revision history for this page on the wiki
MediaWiki 1.23.17
https://script.spoken-tutorial.org/index.php?title=Java-Business-Application/C2/Servlet-Methods/English&diff=21398&oldid=prev
Nancyvarkey at 08:58, 13 April 2015
2015-04-13T08:58:47Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 08:58, 13 April 2015</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 247:</td>
<td colspan="2" class="diff-lineno">Line 247:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|-</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| Type '''<del class="diffchange diffchange-inline">spoken</del><nowiki>*123 </nowiki>'''as the '''Password.'''</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| Type '''<ins class="diffchange diffchange-inline">arya</ins><nowiki>*123 </nowiki>'''as the '''Password.'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| And '''arya<nowiki>*123 </nowiki>'''as the '''Password.'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| And '''arya<nowiki>*123 </nowiki>'''as the '''Password.'''</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
Nancyvarkey
https://script.spoken-tutorial.org/index.php?title=Java-Business-Application/C2/Servlet-Methods/English&diff=12135&oldid=prev
PoojaMoolya at 09:56, 25 June 2014
2014-06-25T09:56:48Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 09:56, 25 June 2014</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 4:</td>
<td colspan="2" class="diff-lineno">Line 4:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Keywords: servlets, video tutorial, GET, POST'''</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>'''Keywords: servlets, video tutorial, GET, POST'''</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><del style="font-weight: bold; text-decoration: none;"></del></div></td><td colspan="2"> </td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{| style="border-spacing:0;"</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{| style="border-spacing:0;"</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| <center>'''Visual Cue'''</center></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>| style="border:1pt solid #000000;padding:0.097cm;"| <center>'''Visual Cue'''</center></div></td></tr>
</table>
PoojaMoolya
https://script.spoken-tutorial.org/index.php?title=Java-Business-Application/C2/Servlet-Methods/English&diff=5698&oldid=prev
Arya Ratish: Created page with ''''Title of script''': Servlet Methods '''Author: arya ''' '''Keywords: servlets, video tutorial, GET, POST''' {| style="border-spacing:0;" | style="border:1pt solid #000000…'
2013-08-23T12:18:26Z
<p>Created page with ''''Title of script''': Servlet Methods '''Author: arya ''' '''Keywords: servlets, video tutorial, GET, POST''' {| style="border-spacing:0;" | style="border:1pt solid #000000…'</p>
<p><b>New page</b></p><div>'''Title of script''': Servlet Methods<br />
<br />
'''Author: arya '''<br />
<br />
'''Keywords: servlets, video tutorial, GET, POST'''<br />
<br />
<br />
<br />
{| style="border-spacing:0;"<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <center>'''Visual Cue'''</center><br />
| style="border:1pt solid #000000;padding:0.097cm;"| <center>'''Narration'''</center><br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 1<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Welcome to the spoken-tutorial on''' Servlet Methods.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 2<br />
| style="border:1pt solid #000000;padding:0.097cm;"| In this tutorial we will learn to<br />
<br />
* create a simple login form using '''JSP'''<br />
* Pass parameters using '''doGet''' '''method'''<br />
* Pass parameters using '''doPost method'''<br />
* Difference between''' doGet '''and '''doPost''' methods<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.106cm;"| Slide 3<br />
<br />
Software Requirements<br />
| style="border:1pt solid #000000;padding:0.106cm;"| Here we are using<br />
<br />
* Ubuntu Version 12.04<br />
* Netbeans IDE 7.3<br />
* JDK 1.7<br />
* Firefox web-browser 21.0<br />
<br />
You can use any web-browser of your choice.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.106cm;"| Slide 4<br />
<br />
Prerequisites<br />
| style="border:1pt solid #000000;padding:0.106cm;"| To follow this tutorial you must know <br />
<br />
* Core Java using '''Netbeans IDE''' <br />
* '''HTML'''<br />
* Basics of '''Java Servlets '''and '''JSPs'''<br />
<br />
If not, for relevant tutorials please visit our website.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 5<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We will begin by creating our web application- the '''Library Management System.'''<br />
<br />
<br />
First, we will create the '''home page.'''<br />
<br />
<br />
The '''home page''' will contain a simple '''login form'''.<br />
<br />
<br />
It will allow authenticated users to login to the '''Library Management System.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Switch to '''Netbeans IDE.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, let us switch to '''Netbeans IDE.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Switch to '''index.jsp '''page.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Let us go to the '''index '''''dot '''''jsp '''page, that we had already modified earlier.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| I have modified this page to create our '''home page.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight the '''title.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We keep the '''title '''as '''Home Page.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''table '''and '''border<nowiki>=1</nowiki>'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Inside the body, we have a '''table, '''with '''border '''''equal to '''''1.'''<br />
<br />
You can have a look at the code here.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''Welcome to Library Management System.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Inside the '''table, '''we have included a '''heading, Welcome to Library Management System.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''This is the home page for Library Management System.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Next, we have '''paragraph tag '''that includes, '''This is the home page for Library Management System.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight the line containing hyperlink.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Then, we have a '''hyperlink, '''which links to a page called '''visitorHomePage '''''dot '''''jsp.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| We will create this page later.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''form.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Next,we have a very simple''' login form.'''<br />
<br />
This form allows a '''registered user''' to '''login''' .<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Before creating the '''form '''we will have to create a '''servlet '''named '''GreetingServlet.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Pause the tutorial and create a new '''servlet '''as explained in the earlier tutorial. <br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Note that the '''servlet name '''is '''GreetingServlet.'''<br />
<br />
<br />
The '''URL pattern '''should be '''GreetingServletPath.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| This''' form''' has two input elements - '''Username and Password.'''<br />
<br />
<br />
It also has a '''Submit button '''that says '''Sign In.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''paragraph tag.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Next, we have a '''paragraph tag '''that includes a link to '''addUser.jsp.'''<br />
<br />
This is the''' registration page''' for those '''users''' who have not yet registered.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, let us go to our GreetingServlet.java. <br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''org.spokentutorial.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Note that '''GreetingServlet.java '''is created in the same package '''org.spokentutorial.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''request object.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| This '''servlet '''will be able to access the '''form data '''from the '''request object.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Point to '''MyServlet.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| This '''servlet '''will act as a '''controller.'''<br />
<br />
<br />
Do you recall that we had come across '''controller '''earlier?<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 6<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, we will see what the '''servlet '''does as a '''controller.'''<br />
<br />
<br />
The '''form data''' will reside in the '''request object.'''<br />
<br />
<br />
The first task is to retrieve the '''form''' data parameters.<br />
<br />
<br />
This is done using the '''getParameter method '''on the '''request object.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Switch to '''Netbeans IDE.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| So, let us switch to '''Netbeans IDE.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''PrintWriter out =response.getWriter();'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type inside the''' doGet method,''' <br />
<br />
'''PrintWriter ''space ''out ''equal to ''response ''dot ''getWriter''.'''''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Next, we will retrieve the '''form data '''parameters.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''String username<nowiki>=</nowiki>request.getParameter(“userName”);'''<br />
<br />
<br />
<br />
| style="border:1pt solid #000000;padding:0.097cm;"| So on the next line type, <br />
<br />
'''String ''space ''username ''equal to ''request ''dot ''getParameter ''within brackets and double quotes ''userName ''semicolon''.'''<br />
<br />
Note that this '''userName '''is the name we have included in the '''form tag '''for '''User Name.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''String password<nowiki>=</nowiki>request.getParameter(“password”);'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Similarly, we will retrieve the '''password''' also.<br />
<br />
So on the next line, type, '''String '''''space '''''username '''''equal to '''''request ''dot ''getParameter ''within brackets and double quotes ''password ''semicolon''.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Next, we will print the '''User Name '''in the '''output'''.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| '''out.println(“Hello from GET Method” + username);'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| So, on the next line type <br />
<br />
'''out ''dot ''println ''within brackets and double quotes ''Hello from GET Method plus username''.'''''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Right click on '''MyFirstProject.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <nowiki><</nowiki>Pause><br />
<br />
To run this project, '''right-click''' on '''MyFirstProject. '''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Click on '''Clean and Build.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Click on '''Clean and Build.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Right click on '''MyFirstProject '''and click on '''Run.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Again right click on '''MyFirstProject '''and click on '''Run.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Hover your mouse over the console.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| The '''server '''is up and running.<br />
<br />
It has deployed '''MyFirstProject.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Hover your mouse over the '''Home Page.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, we have got our '''home page '''displayed in the '''browser'''.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Point the mouse to the '''title.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Observe that the '''title '''of the page is '''Home Page.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Hover your mouse over the login form.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We can see a very simple '''login form''' here.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Let me enter the '''Username '''and '''Password.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''spoken '''in the '''textbox.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| I will type '''arya '''as the '''Username.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''spoken<nowiki>*123 </nowiki>'''as the '''Password.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| And '''arya<nowiki>*123 </nowiki>'''as the '''Password.'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Click on '''Sign In.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Then click on '''Sign In.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Hover your mouse over the browser window.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We can see that we have got the output '''Hello from GET Method''' '''arya'''.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, the '''user '''was able to login here because we have not included any validation inside the code. We will do this in the later tutorial. <br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight the form data.<br />
<br />
Highlight the question mark.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, have a look at the '''URL '''here.<br />
<br />
It is '''localhost '''''colon '''''8080 '''''slash '''''MyFirstProject '''''slash '''''GreetingServletPath '''''question mark '''''userName '''''equal to '''''arya&password '''''equal to '''''arya<nowiki>*123.</nowiki>'''<br />
<br />
The '''form data '''is separated from the page information by a ''question mark.''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight '''userName<nowiki>=</nowiki>spoken&password<nowiki>=</nowiki>spoken<nowiki>*123</nowiki>'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We can see the '''username '''and '''password '''that we had entered in the '''form is '''inside the URL also.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, let us try '''to do''' the same using '''POST Method.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Switch back to the '''IDE.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Switch back to the '''IDE.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Copy the code we had written for the '''doGet Method '''and paste it in the '''doPost Method.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Copy the code we had written for the '''doGet Method '''and paste in the '''doPost Method.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Change '''GET '''to '''POST.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, change the '''println''' statement to '''Hello from POST Method.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Open '''index.jsp.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, let us open '''index '''''dot '''''jsp.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Change '''GET '''to '''POST'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Here, we must change the '''method attribute '''of the '''form tag '''to '''POST.'''<br />
<br />
<br />
You can have a look at this code now.<br />
<br />
<br />
We have '''form action '''''equal to '''''GreetingServletPath method '''''equal to '''''POST.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Type '''method<nowiki>=”</nowiki>POST”.'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, we will r'''un this Project again'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Right click on '''MyFirstProject '''and click '''on Run'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Highlight the output.<br />
| style="border:1pt solid #000000;padding:0.097cm;"| We have got an output similar to the one we got, when we used the '''GET method.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| So let us type the '''User Name '''and '''Password '''again.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Then click on '''Sign In.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Note that we have got '''Hello from POST Methodarya.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, take a look at the '''URL.'''<br />
<br />
'''localhost '''''colon '''''8080 '''''slash '''''MyFirstProject '''''slash '''''GreetingServletPath '''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Here we do not see the '''form data '''in the '''URL '''of the '''request.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| This is the major difference between '''doGet '''and '''doPost Methods.'''<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| '''Slide 7'''<br />
<br />
'''When to use GET and POST Methods?'''<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Now, let us learn when to use '''GET '''and when to use '''POST Methods.'''<br />
<br />
<br />
'''GET Method '''is used when:<br />
<br />
* the '''form '''is small and hence the '''data '''is less.<br />
* the '''user''' wants the contents of the data to be visible in the '''URL.'''<br />
<br />
'''POST Method '''is used when:<br />
<br />
* the '''form '''is large and hence the '''data '''is more.<br />
* the '''user''' does not want the contents of the data to be visible in the '''URL.'''<br />
<br />
ex: '''passwords'''<br />
<br />
<nowiki><</nowiki>Pause><br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 9<br />
<br />
Summary<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Let us summarize.<br />
<br />
In this tutorial we have learnt to:<br />
<br />
* create a simple login form using '''JSP'''<br />
* Pass parameters using '''doGet''' '''method'''<br />
* Pass parameters using '''doPost method'''<br />
* Difference between''' doGet '''and '''doPost''' methods<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| <br />
| style="border:1pt solid #000000;padding:0.097cm;"| Please make sure that you have completed this tutorial before proceeding further.<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 10<br />
<br />
About slide<br />
<br />
<br />
<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Watch the video available at the following link.<br />
<br />
* It summarizes the Spoken Tutorial Project<br />
* If you do not have good bandwidth you can download and watch it<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 11<br />
<br />
About slide<br />
| style="border:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team<br />
<br />
* Conducts workshops using spoken tutorials<br />
* Gives certificates for those who pass an online test<br />
* For more details please write to contact at spoken hyphen tutorial dot org<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 12<br />
<br />
Acknowledgement<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Spoken Tutorial Project is a part of the Talk to a Teacher Project<br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India<br />
* More information on this mission is available at<br />
* http://spoken-tutorial.org/NMEICT-Intro<br />
<br />
<br />
<br />
|-<br />
| style="border:1pt solid #000000;padding:0.097cm;"| Slide 13<br />
<br />
Contributor Slide<br />
| style="border:1pt solid #000000;padding:0.097cm;"| The Library Management System has been contributed by a leading software MNC, through their Corporate Social Responsibility Programme.<br />
<br />
<br />
They have also validated the content for this spoken tutorial.<br />
<br />
<br />
This is Arya Ratish from IIT Bombay signing off.<br />
<br />
<br />
Thank you for joining.<br />
<br />
|}</div>
Arya Ratish