Ex. No. : Simple Servlet Showing Different Styles of a Phrase
|
|
- Edward Gibbs
- 6 years ago
- Views:
Transcription
1 Ex. No. :01 Advanced Java Programming Lab (J2EE) Simple Servlet Showing Different Styles of a Phrase 1
2 UML NOTATION 2
3 SOURCE CODE //simple servlet application showing various styles of a text import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class DiffShadowsServlet extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); out.println("<html>"); out.println("<head>"); out.println("<title>servlet DiffShadowsServlet</title>"); out.println("<style>"); out.println("h1width:50%"); out.println("h4width:100%"); out.println("</style>"); out.println("</head>"); out.println("<body>"); out.println("<h1 style=filter:dropshadow()>god IS GREAT</h1>"+"dropshadow effect"); out.println("<h1 style=filter:shadow()>god IS GREAT</h1>"+"shadow effect"); 3
4 out.println("<h1 style=filter:fliph()>god IS GREAT</h1>"+"flip horizontal"); out.println("<h1 style=filter:flipv()>god IS GREAT</h1>"+"flip vertical"); out.println("<h1 style=filter:glow()>god IS GREAT</h1>"+"glow effect"); out.println("<h1 style=filter:wave(strength=3)>god IS GREAT</h1>"+"wave effect"); out.println("</body>"); out.println("</html>"); out.close(); 4
5 SAMPLE SCREEN 5
6 Ex. No. : Advanced Java Programming Lab (J2EE) Displaying Multiplication Table in Servlet for a Number Entered in Html Page (Html to Servlet Communication) 6
7 UML NOTATION 7
8 SOURCE CODE <!..Multiplication Table..!> <html> <head> <title>multiplication Table</title> </head> <body background="c:\documents and Settings\ANNAI\WebApplication1\web\circles.png"> <form action=" method="dopost" > <br> <br> <br> <b> <font color="red" size="10"> Enter the number to which you want to display the multiplication table</b> <input type="text" name="tbltxt" title="enter a number" ><br> <input type="submit" name="tblbut" value="display MULTIPLICATION TABLE"> </font> </form> </body> </html> 8
9 SAMPLE SCREEN 9
10 SOURCE CODE //Displaying Multiplication Table import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TableServlet extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); int i; int number=integer.parseint(request.getparameter("tbltxt")); out.println("<strong><u>"+"displaying the multiplication table for the number: "+number+"</u></strong><br>"); for(i=1;i<=10;i++) out.println("<font color=abcdef size=5>"+i+" * "+number+" = "+(i*number)+"<br>"); out.close(); 10
11 SAMPLE SCREEN 11
12 Ex. No. : Advanced Java Programming Lab (J2EE) Manipulating Strings in Servlet Entered in Html (Html to Servlet Communication) 12
13 UML NOTATION 13
14 SOURCE CODE <!.. String Manipulation..!> <html> <head> </head> <body BGCOLOR="BABABA"> <form method="post" action=" ENTER THE STRING HERE-----> <input type="text" name="t1" value="" TITLE="ENTER TEXT HERE!.."> <BR>CHOOSE AN OPERATION HERE <BR> LENGTH <input type="submit" name="r1" value="finding Length"><BR> REVERSE<input type="submit" name="r2" value="reversing the String"><BR> UPPERCASE <input type="submit" name="r3" value= "To Upper Case"><BR> LOWERCASE <input type="submit" name="r4" value="to Lower Case"><BR> NUMBER OF WORDS <input type="submit" name="r5" value="counting Number of Words"> </form> </body> </html> 14
15 SAMPLE SCREEN 15
16 SOURCE CODE //String Manipulation import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class StringServlet extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html"); PrintWriter out = response.getwriter(); String str=request.getparameter("t1"); out.println("<a href=stringmaniphtml.html>backk</a><br>"); String ui; String xx[]=new String[2]; int i=0; Enumeration e=request.getparameternames();//this stores all the component names as a collection while(e.hasmoreelements()) ui=(string)e.nextelement(); xx[i]=request.getparameter(ui); i++; 16
17 if(xx[1].equalsignorecase("to Lower Case")) out.println("the Operation Chosen is :"+"<font color=red size=5>"+xx[1]+"</font>"); out.println("<br>the String entered is :"+"<font color=ffbbee size=5>"+xx[0]+"</font>"); out.println("<hr color=purple><br>"); out.println("<br><font size=6 color=12345>"); out.println("the RESULT IS :"+xx[0].tolowercase()); else if(xx[0].equalsignorecase("finding Length")) out.println("the Operation Chosen is :"+"<font color=red size=5>"+xx[0]+"</font>"); out.println("<br>the String entered is :"+"<font color=ffbbee size=5>"+xx[1]+"</font>"); out.println("<hr color=purple><br>"); out.println("<br><font size=6 color=12345>"); out.println("the RESULT IS :"+xx[1].length()); else if(xx[0].equalsignorecase("reversing the String")) out.println("the Operation Chosen is :"+"<font color=red size=5>"+xx[0]+"</font>"); out.println("<br>the String entered is :"+"<font color=ffbbee size=5>"+xx[1]+"</font>"); 17
18 out.println("<hr color=purple><br>"); out.println("<br><font size=6 color=12345>"); StringBuffer sb=new StringBuffer(xx[1]); out.println("the RESULT IS :"+sb.reverse());; else if(xx[0].equalsignorecase("to Upper Case")) out.println("the Operation Chosen is :"+"<font color=red size=5>"+xx[0]+"</font>"); out.println("<br>the String entered is :"+"<font color=ffbbee size=5>"+xx[1]+"</font>"); out.println("<hr color=purple><br>"); out.println("<br><font size=6 color=12345>"); out.println("the RESULT IS :"+xx[1].touppercase()); else if(xx[1].equalsignorecase("counting Number of Words")) out.println("the Operation Chosen is :"+"<font color=red size=5>"+xx[1]+"</font>"); out.println("<br>the String entered is :"+"<font color=ffbbee size=5>"+xx[0]+"</font>"); out.println("<hr color=purple><br>"); out.println("<br><font size=6 color=12333>"); int len=xx[0].length(); int wcount=0; for(i=0;i<len;i++) 18
19 if(xx[0].charat(i)==' ') wcount=wcount+1; wcount++; out.println("the RESULT IS :"+wcount); 19
20 SAMPLE SCREEN 20
21 Ex. No. : Advanced Java Programming Lab (J2EE) Designing a Login Form Using Html and Displaying the Contents of the Login Form along with Date and Time in Servlet (Html to Servlet Communication) 21
22 UML NOTATION 22
23 SOURCE CODE <!..login html form..!> <html> <head> <title>html authenticator</title> </head> <body> <form action=" method="dopost"> <table border="5" align="center" > <th><font size=9 color=red>log IN SCREEN</font></th> <tr> <td> <b><font size=6>user Name </font></b> <input type="text" name="mytext1" value="" title="enter User Name"> <td> </tr> <tr> <td> <b><font size=6> Password </font></b><input type="password" name="mytext2" value="" Title="Enter Password"> <td> </tr> <tr> <td align="center"> <b><font size=7><centre><input type="submit" name="mysubmit" value="submit" align="middle"><input type="reset" name="myreset" value="cancel"> </font></b> 23
24 <td> </tr> </table> </form> </body> </html> 24
25 SAMPLE SCREEN 25
26 SOURCE CODE // Displaying the Contents of the Login Form along with Date and Time, authenticator with out //validation import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*; public class TrialServletOnHtml extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); Date dd=new Date(); out.println(dd); Calendar c=calendar.getinstance(); out.println("<br><b><font color=blue><u><i>date TODAY IS:</i></u></b></font>"); out.println(c.get(calendar.date)+":"); out.println(c.get(calendar.month)+":"); out.println(c.get(calendar.year)); out.println("<br><b><font color=red ><u><i>time NOW IS:</i></u></b></font>"); out.println(c.get(calendar.hour)+":"); out.println(c.get(calendar.minute)+":"); out.println(c.get(calendar.second)); 26
27 out.println("<hr color=ff0ff0>"); out.println("<br>" ); out.println("<b><i>you are now logged into "+"<font color=red><u>"+request.getrequesturl()+"</u></font></i></b>"); out.println("<br><br>user NAME : "+request.getparameter("mytext1")); out.println("<br>password : "+request.getparameter("mytext2")); out.close(); 27
28 SAMPLE SCREEN 28
29 Ex. No. : Advanced Java Programming Lab (J2EE) Registering a New User and Displaying the Number of Visits Made by the Existing User using Cookies (Html to Servlet Communication) 29
30 UML NOTATION 30
31 SOURCE CODE <!.. Registering a New User and Displaying the Number of Visits Made by the Existing User( using Cookies)..!> <html> <head> <title>cs APPLICATIONS </title> </head> <body> <marquee><b><font color =brown size=70> COMPUTER INDUSTRIES </font></b> </marquee> <form action=" method="dopost"> Enter your name to check the number of visits made by you in this site <input type="text" name="txt"> <input type="submit" name="sub" value="checker"> </body> </html> 31
32 SAMPLE SCREEN 32
33 SOURCE CODE // Registering a New User and Displaying the Number of Visits Made by the Existing // User(using Cookies) import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class Cook1Servlet extends HttpServlet String name; public void doget(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException PrintWriter pw=res.getwriter(); name=req.getparameter("txt"); String cnt="1"; int chk=0; String nwcount=""; Cookie c=new Cookie(name,cnt); c.setmaxage(24*60*60); res.addcookie(c); 33
34 Cookie[] storecookie=req.getcookies(); int i; int count; if(storecookie!=null) for(i=0;i<storecookie.length;i++) String cname=storecookie[i].getname(); String coccur=storecookie[i].getvalue(); if(name.equals(cname)) count=integer.parseint(coccur); count=count+1; nwcount=integer.tostring(count); Cookie cc=new Cookie(cname,nwcount); 34
35 cc.setmaxage(24*60*120); res.addcookie(cc); chk=1; if(chk==1) pw.println("welcome, <b><i><font size=5 color=red face=tahoma>"+name+" </font></i></b>you are NOT a new Visitor and you have been visiting for "+nwcount+" times"); else pw.println("welcome, <b><i><font size=5 color=red face=tahoma>"+name+" </font></i></b> You are a new visitor and you are registered"); 35
36 SAMPLE SCREEN 36
37 Ex. No. : Advanced Java Programming Lab (J2EE) Finding the Presence of a value and its Position in the Cookie List, otherwise Registering the Value as a Cookie (Html to Servlet Communication) 37
38 UML NOTATION 38
39 SOURCE CODE <!.. Finding the Presence of a value and its Position in the Cookie List, otherwise Registering the Value as a Cookie..!> <html> <head> <title>cookies</title> </head> <marquee direction="up"><font color="green">finding the presence of an entered value in the form of cookie and it lasts for some days</font></marquee> <body> <form action=" method="post"> ENTER SOMETHING TO SET AS COOKIE <input type="text" name="txt"> <input type="submit" name="sub" value="press"> </form> </body> <marquee direction="down"><font color="green">finding the presence of an entered value in the form of cookie and it lasts for some days</font></marquee> </html> 39
40 40
41 SOURCE CODE // Finding the Presence of a value and its Position in the Cookie List, otherwise Registering the //Value as a Cookie import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class StoreCookieServlet extends HttpServlet public void service(httpservletrequest req, HttpServletResponse res) throws ServletException, IOException PrintWriter pw=res.getwriter(); String name=req.getparameter("txt"); pw.println("<b><font size=6 color=orange>the entered value to set as a cookie is String cnt="1"; :</font><font size=7>"+name+"</font></b>"); Cookie cc=new Cookie(name,cnt); cc.setmaxage(24*60*60); res.addcookie(cc); pw.println("cookie saved"); Cookie[] storedcookie=req.getcookies(); int i; int count; if(storedcookie!=null) 41
42 pw.println("<br>there are some cookies found here already "); pw.println("<br>cookies saved so far!..."+storedcookie.length+"<br>"); for(i=0;i<storedcookie.length;i++) String cname=storedcookie[i].getname(); String coccur=storedcookie[i].getvalue(); pw.print("<br><font color=red>"+"at location "+i+" we have "+cname+"<hr>"); if(name.equals(cname)) pw.println("<font color=green>"+"the cookie is already exixting at "+i+" is"+cname); 42
43 SAMPLE SCREEN 43
44 44
45 Ex. No. : Advanced Java Programming Lab (J2EE) Mark List Processing in Servlet with Records Taken from MS-Access (Servlet and JDBC connectivity) 45
46 UML NOTATION 46
47 Table Description Table with Records 47
48 SOURCE CODE //JDBC Connectivity with MS-Access, Mark List Preparation import javax.servlet.http.*; import javax.servlet.*; import java.io.*; import java.sql.*; public class JdbcQuery extends HttpServlet public void service(httpservletrequest req,httpservletresponse res) throws ServletException,IOException PrintWriter out=res.getwriter(); res.setcontenttype("text/html"); Connection c=null; Statement s=null; ResultSet rs; int regno[]=new int[50]; String sname[]=new String[50]; int mark1[]=new int[50]; int mark2[]=new int[50]; int mark3[]=new int[50]; int total[]=new int[50]; 48
49 float avg[]=new float[50]; String result[]=new String[50]; int i=0; int j; try // driver selection and DSN (database) Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // out.println("connected"); c=drivermanager.getconnection("jdbc:odbc:trialdb"); catch(exception e) out.println("runtime Error occured, fix it and is as shown by JRS as --"+e); try s=c.createstatement(); rs=s.executequery("select * from Table3"); out.println("god Is Great"); while(rs.next()) //retrieval of records 49
50 regno[i]=rs.getint(1); sname[i]=rs.getstring(2); mark1[i]=rs.getint(3); mark2[i]=rs.getint(4); mark3[i]=rs.getint(5); //processing the details if(mark1[i]>40 && mark2[i]>40 && mark3[i]>40) result[i]="pass"; else result[i]="fail"; total[i]=mark1[i]+mark2[i]+mark3[i]; avg[i]=total[i]/3; i=i+1; // showing the records in the table out.println("<u> <i> <font size=12><center>student Mark List Preparation</center></font></i></U>"); out.println("<table border=2 ALIGN = CENTER>"); out.println("<th><b><font color=blue>name</b></th>"); out.println("<th><b><font color=blue>register Number </b> </th>"); out.println("<th><b><font color=blue>j2ee</b> </th>"); out.println("<th><b><font color=blue>software Engineering </b> </th>"); 50
51 out.println("<th><b><font color=blue>operating System </b> </th>"); out.println("<th><b><font color=blue>total</b> </th>"); out.println("<th><b><font color=blue>average</b> </th>"); out.println("<th><b><font color=blue>result</b> </th>"); for(j=0;j<i;j++) out.println("<tr>"); out.println("<td >"+regno[j]+"</td>"); out.println("<td >"+sname[j]+"</td>"); out.println("<td align=center>"+mark1[j]+"</td>"); out.println("<td align=center>"+mark2[j]+"</td>"); out.println("<td align=center>"+mark3[j]+"</td>"); out.println("<td align=center>"+total[j]+"</td>"); out.println("<td align=center>"+avg[j]+"</td>"); out.println("<td align=center><b><font color=green>"+result[j]+"</font></td>"); out.println("</tr>"); out.println("</table>"); catch(exception E) System.out.println("Error!.., while fetching record and error description is shown as StackTrace of java "+E); 51
52 SAMPLE SCREEN 52
53 Ex. No.: 08 Advanced Java Programming Lab (J2EE) Viewing the Records Stored in Oracle Table (Servlet and JDBC Connectivity ) 53
54 UML NOTATION 54
55 Table Description 55
56 SOURCE CODE <!..form designing with UI to view records in Oracle table..!> <html> <head> <title>view</title> </head> <body> <form action=" method="get"> <input type="submit" name="b1" value="view"> </form> </body> </html> 56
57 SAMPLE SCREEN 57
58 SOURCE CODE // viewing records in the servlet taken from Oracle table import java.io.*; import java.net.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class ViewServ extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); Connection c=null; Statement s=null; ResultSet rs; if(request.getparameter("b1").equals("view")) try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 58
59 c=drivermanager.getconnection("jdbc:odbc:trialconnect","scott","tiger"); out.println("<b><font color=green size=7>god IS GREAT</font></b>"); out.println("<br> Records form LOGIN TABLE"); s=c.createstatement(); rs=s.executequery("select * from LOGINTABLE"); int i=1; while(rs.next()) out.println("<br>"); out.println(i); out.println(rs.getstring(1)); out.println(rs.getstring(2)); out.println(rs.getint(3)); out.println("<br>"); out.println("<hr>"); out.println("<br>"); i++; //try ends here catch(exception ee) 59
60 out.println("error has occured"+ee); //catch ends here 60
61 SAMPLE SCREEN 61
62 Ex. No. 09 Advanced Java Programming Lab (J2EE) Inserting Values in to Oracle Table (Servlet and JDBC Connectivity) 62
63 UML NOTATION 63
64 SOURCE CODE <!.. Form design with UI to insert values into Oracle Table..!> <html> <head> <title>insert</title> </head> <body> <form action=" method="get"> Enter your Name: <input type="text" name="t1" value=""> <br> Enter Password : <input type="password" name="t2" value=""> <br> Enter Lucky Number: <input type="text" name="t3" value=""> <br> <input type="submit" name="b1" value="insert"> </form> </body> </html> 64
65 SAMPLE SCREEN 65
66 SOURCE CODE //Servlet to insert values taken from html form into Oracle table import java.io.*; import java.net.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class InsertServ extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); Connection c=null; Statement s=null; if(request.getparameter("b1").equals("insert")) try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); c=drivermanager.getconnection("jdbc:odbc:trialconnect","scott","tiger"); out.println("<b><font color=red size=7>god IS GREAT</font></b>"); s=c.createstatement(); 66
67 String nam=request.getparameter("t1"); int lnum=integer.parseint(request.getparameter("t3")); String pwd=request.getparameter("t2"); s.executeupdate("insert INTO LOGINTABLE"+ "(name, pwrd,luckynum)" + " VALUES ('"+nam+"','"+pwd+"',"+lnum+")"); out.println("<br>record Inserted!..."); //try ends here catch(exception ee) out.println("error has occured"+ee); //catch ends here 67
68 SAMPLE SCREEN 68
69 Values from Oracle Table 69
70 Ex. No Advanced Java Programming Lab (J2EE) Deleting a record from Oracle Table (Servlet and JDBC Connectivity) 70
71 UML NOTATION 71
72 SOURCE CODE <!..Form Design with UI to get Name to Delete the appropriate record having the name from Oracle Table..!> <html> <head> <title>delete</title> </head> <body> <form action=" method="get"> Enter Name, which you want to delete : <input type="text" name="tt" > <br> <input type="submit" name="b1" value="delete"> </form> </body> </html> 72
73 SAMPLE SCREEN 73
74 SOURCE CODE // Servlet to Delete a record from Oracle Table when name is entered through the form shown //previously import java.io.*; import java.net.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; public class DeleteServ extends HttpServlet protected void service(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException response.setcontenttype("text/html;charset=utf-8"); PrintWriter out = response.getwriter(); Connection c=null; Statement s=null; String nam=null; ResultSet rs; try Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); c=drivermanager.getconnection("jdbc:odbc:trialconnect","scott","tiger"); s=c.createstatement(); 74
75 out.println("god IS GREAT"); nam=request.getparameter("tt"); catch(exception e) System.out.println("THE ERROR:"+e); try s.executeupdate("delete from LOGINTABLE where Name="+"'nam'"); out.println("<br>record Deleted!..."); //try ends here catch(exception ee) out.println("error has occured :"+ee); //catch ends here 75
76 SAMPLE SCREEN 76
77 Ex. No Advanced Java Programming Lab (J2EE) Applet Reading the Contents from Servlet and Changing the Colors of the Contents Using User Interfaces (Servlet to Applet Communication) 77
78 UML NOTATION UML NOTATION 78
79 SOURCE CODE //Servlet having the contents //servlet program import javax.servlet.*; import javax.servlet.http.*; public class TrialServlet extends HttpServlet protected void doget(httpservletrequest request, HttpServletResponse response) throws ServletException, IOException //response.setcontenttype("application"); PrintWriter out = response.getwriter(); //The following will be sent to Applet(AppServComm) to get displayed as a concatenated String out.println("1.god IS GREAT "); out.println("2.god IS DIVINE "); out.println("3.god is LOVE "); 79
80 SAMPLE SCREEN 80
81 SOURCE CODE //applet program to read contents from the servlet and display in the TextArea import java.applet.*; import java.awt.*; import java.net.*; import java.awt.event.*; import java.io.*; public class AppServComm extends Applet implements ActionListener,ItemListener Button b; Color cc; TextArea tf; String s; String ss=new String(); StringBuffer sb=new StringBuffer(); Checkbox r,bl,g; CheckboxGroup cg; public AppServComm() this.setlayout(null); setbackground(color.red); 81
82 setsize(1500,500); tf=new TextArea("THIS IS AN APPLET GENERATED OUTPUT",30,40); b=new Button("I will be connecting you a servlet"); cc=new Color(100,200,200); cg=new CheckboxGroup(); r=new Checkbox("RED",cg,true); bl=new Checkbox("BLUE",cg,false); g=new Checkbox("GREEN",cg,false); b.setbounds(200,200,270,30); b.setbackground(cc); add(b); r.setbounds(200,700,150,30) ; add(r); r.additemlistener(this); bl.setbounds(400,700,150,30) ; add(bl); bl.additemlistener(this); g.setbounds(600,700,150,30) ; add(g); g.additemlistener(this); tf.setbounds(200,400,550,130); tf.setbackground(cc); add(tf); 82
83 b.addactionlistener(this); public void itemstatechanged(itemevent i) if(i.getsource().equals(r)) tf.setforeground(color.red); else if(i.getsource().equals(bl)) tf.setforeground(color.blue); else if(i.getsource().equals(g)) tf.setforeground(color.green); public void actionperformed(actionevent a) try if(a.getactioncommand().equals("i will be connecting you a servlet")) tf.settext("god is divine and soul"); URL url=new URL(getCodeBase()," URLConnection con=url.openconnection(); con.setdoinput(true); 83
84 DataInputStream dis=new DataInputStream(con.getInputStream()); this.showstatus("this is the output from SERVLET"); while((s=dis.readline())!=null) ss=sb.append(s).tostring(); //while ends tf.settext(ss); //if ends //try ends catch(exception e) System.out.println(e); //method ends here SAMPLE SCREEN 84
85 85
86 86
87 Ex. No Advanced Java Programming Lab (J2EE) Sending Contents from a File to Servlet via Applet and Receiving the same from Servlet and Displaying in Applet's Textarea (Applet to Servlet Communicatin, File Handling) 87
88 UML NOTATION 88
89 SOURCE CODE //sending contents from a file to Servlet via Applet and receiving the same from Servlet and displaying in Applet's TextArea import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.io.*; public class AppletClass extends Applet implements ActionListener Button b,bb; String s; TextArea ta; Label l; URL url; URLConnection con; DataOutputStream dos; DataInputStream dis; FileInputStream in; byte[] buf; int bytesread = 0; public AppletClass() 89
90 setlayout(null); b=new Button("Send to servlet"); bb=new Button("From Servlet"); ta=new TextArea(50,50); l=new Label(); s="god is Great"; b.setbounds(300,300,100,20); add(b); bb.setbounds(300,400,100,20); add(bb); l.setbounds(500,350,350,20); add(l); ta.setbounds(900,300,300,200); add(ta); b.addactionlistener(this); bb.addactionlistener(this); public void actionperformed(actionevent myevent) try showstatus("god IS GREAT"); 90
91 in = new FileInputStream("d:/TrialFile.txt"); buf=new byte[in.available()]; url=new URL(" con=url.openconnection(); con.setdooutput(true); con.setusecaches (true); con.setdefaultusecaches (true); con.setdoinput(true); dos=new DataOutputStream(con.getOutputStream()); dis=new DataInputStream(con.getInputStream()); if(myevent.getsource().equals(b)) while( (bytesread = in.read( buf )) > -1 ) dos.write( buf, 0, bytesread ); dos.flush(); dos.close(); in.close(); 91
92 l.setbackground(color.red); l.setforeground(color.black); l.settext("content from the file has been sent to Servlet"); showstatus("sent "+dos.size()+" bytes of data"); //if ends else if(myevent.getsource().equals(bb)) ta.settext("god IS DIVINE") ; String s=" "; StringBuffer sb=new StringBuffer(s); String ss=new String(); int word=0; String sw=new String(); while((bytesread=dis.read())>-1) if(((char)bytesread)==' ') word++; ss=s.valueof((char)bytesread); 92
93 sb=sb.append(ss); showstatus("number of words read="+sw.valueof(word)); System.out.println(sb.toString()); l.setbackground(color.red); l.setforeground(color.black); l.settext("content from the SERVLET is now shown here in this TextArea"); ta.settext("god IS GREAT"); ta.setbackground(color.orange); ta.setforeground(color.black); ta.settext(sb.tostring()); //try ends catch(exception e) System.out.print("MY EXCEPTION:"+e); //method ends //class ends 93
94 SAMPLE SCREEN TrialFile.txt 94
95 95
96 Ex. No. : Advanced Java Programming Lab (J2EE) Servlet program to read contents from file and write the same into another file and also display the read contents on the browser (Servlet and File Manipulation) 96
97 UML NOTATION 97
98 SOURCE CODE //Servlet program to read contents from file(trialfile.text) and write the same into another file(writefile.text) and also display the read contents on the browser with some customization import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.net.*; public class ServletClass extends HttpServlet public void service(httpservletrequest req,httpservletresponse res) //ServletContext sc = this.getservletcontext(); try PrintWriter out=res.getwriter(); FileInputStream fis=new FileInputStream("d:/TrialFile.txt"); 98
99 FileOutputStream tofile = new FileOutputStream("d:/WriteFile.txt" ); byte[] buff = new byte[1024]; int cnt = 0; String s=null; //writting data from Myfile.txt to Filr2.txt while( (cnt = fis.read(buff )) > -1 ) tofile.write( buff, 0, cnt ); //reading data from Filr2.txt and showing the same on the browser FileReader fr=new FileReader("d:/Filr2.txt"); int c=0; int i; out.println("<marquee direction=right><font color=yellow size=7 face=forte>god IS GREAT</marquee>"); out.println("<body bgcolor=black>"); out.println("<br><b><u><font size=4 color=blue face=algerian>contents read from a file</font></u></b><br>"); out.println("<p><font size=3 color=red face=tahoma>"); while((i=fr.read())>-1) out.println((char)i); 99
100 c++; out.println("<br><font size=5 color=green face=forte><u>number of characters read ="+c); catch(exception e) e.printstacktrace(); 100
101 SAMPLE SCREEN TrialFile.txt WriteFile.txt 101
102 Showing the contents on the brower 102
103 Ex. No. : Advanced Java Programming Lab (J2EE) Making a Class Serializable and Sending Data as Object from Applet to Servlet (Using Serializable Interface) 103
104 UML NOTATION UML NOTATION 104
105 SOURCE CODE //making a class serializable and sending data as object import java.applet.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.io.*; import java.util.*; public class SeriallizableAppClass extends Applet implements ActionListener Button b; String s; URL url; URLConnection con; TrialSerial ts; DataOutputStream dos; public SeriallizableAppClass() b=new Button("Send to servlet"); s="god is Great"; add(b); 105
106 b.addactionlistener(this); public void actionperformed(actionevent myevent) if(myevent.getsource().equals(b)) try showstatus("god IS GREAT"); url=new URL(" con=url.openconnection(); con.setdooutput(true); con.setusecaches (true); con.setdefaultusecaches (true); ts=new TrialSerial(); s="this is the serialized data set to Servlet (SerializableServletClass): "+ts.sendstring(); ObjectOutputStream oos=new ObjectOutputStream(con.getOutputStream()); 106
107 oos.writeobject(ts); repaint(); oos.close(); showstatus("sent data"); catch(exception e) System.out.println("MY EXCEPTION:"+e); //if ends //method ends public void paint(graphics gg) gg.drawstring(s,300,300); class TrialSerial implements Serializable public String S; 107
108 public TrialSerial() S="GOD IS DIVINE SOUL AND LOVE"; String sendstring() return(s); 108
109 SAMPLE SCREEN 109
110 Ex. No. 15 Advanced Java Programming Lab (J2EE) Simple JSP showing increased font size 110
111 UML NOTATION 111
112 SOURCE CODE <%-- simple jsp to display a phrase with increasing font size --%> <%@ page import="java.io.*"%> <html> <head> <title>trial JSP</title> </head> <body bgcolor=pink> <% out.println(new java.util.date());%> <% int i; for(i=1;i<=7;i++) out.write("<br>"); out.print("<font size="+i+">god IS GREAT"); // out.println("</font>"); %> <% %> </body> </html> 112
113 SAMPLE SCREEN 113
114 Ex. No. 16 Advanced Java Programming Lab (J2EE) Incorporating HTML in JSP 114
115 UML NOTATION 115
116 SOURCE CODE <!.. This html file will be used in jsp..!> <html> <marquee><big> This is an incorporated html's view</big></marquee> <ul >Unordered List <li>lotus</li> <li>sunflower</li> <li>rose</li> <li>daisy</li> <li>pansy</li> </ul> <ol > Ordered List <li>lotus</li> <li>sunflower</li> <li>rose</li> <li>daisy</li> <li>pansy</li> </ol> </html> 116
117 SAMPLE SCREEN 117
118 SOURCE CODE <%-- including html file--%> <%-- JSP using Flowers.html --%> page import="java.io.*"%> <html> <body> <h3><font color=green>flowers</font></h3> <%out.println("<font size=7 color=violet>god IS GREAT</font>");%> include file="flowers.html" %> </body> </html> 118
119 SAMPLE SCREEN 119
120 Ex. No Advanced Java Programming Lab (J2EE) Printing Fibonacci Series (HTML, JSP, Servlet communication) 120
121 UML NOTATION 121
122 SOURCE CODE <html> <head> <title></title> </head> <body bgcolor=cyan> <form action=" method="post"> Enter a value and upto that Fibonocci series will be shown: <input type="text" name="txt" value="" title="enter a number to generate Fibonocci series"><br>    <input type="submit" name="but1" value="fibonocci SERIES GENERATOR"> </form> </body> </html> 122
123 SAMPLE SCREEN 123
124 SOURCE CODE page import="java.io.*"%> page import="java.util.*"%> page import="javax.servlet.*"%> <html> <head> <title>jsp Page</title> </head> <body> <% int n=0; String s; int ov=0; int cv=1; int nv=0; if(request.getparameter("txt")!=null) n=integer.parseint(request.getparameter("txt")); if(n!=0) out.println("<b><font size=5 color=blue>here is the generated FIBONOCCI SERIES </font></b>"); 124
125 out.println(ov); out.println(cv); out.println("<br><b><font size=5 color=red>"); do nv=ov+cv; ov=cv; cv=nv; if(nv<n) out.println(cv); while(nv<n); out.println("</font></b>"); out.println("<br><a href= to the place to enter value</a>"); %> </body></html> 125
126 SAMPLE SCREEN 126
127 Ex. No. 18 Advanced Java Programming Lab (J2EE) Client Server Communication using RMI 127
128 UML NOTATION 128
129 SOURCE CODE //DECLARING INTERFACE import java.rmi.*; public interface MyInterface extends Remote void printsomething()throws RemoteException; //IMPLEMENTING INTERFACE(REMOTE) import java.rmi.*; import java.rmi.server.*; public class MyClassMyInterface extends UnicastRemoteObject implements MyInterface public MyClassMyInterface()throws RemoteException public void printsomething()throws RemoteException System.out.println("GOD IS GREAT");
130 // PROGRAM TO BIND THE REMOTE CLASS WITH RMI REGISTRY import java.net.*; import java.rmi.*; public class MyServer public static void main(string myc[]) try MyClassMyInterface mi=new MyClassMyInterface(); Naming.rebind("MyClass",mi); catch(exception excep) System.out.println("Throwing runtime error, please catch it -----"+excep);
131 // CLIENT PROGRAM TO CALL THE REMOTE METHOD import java.rmi.*; public class MyClient public static void main(string myc[]) try String str="rmi://"+myc[0]+"/myclass"; MyInterface min=(myinterface)naming.lookup(str); min.printsomething(); catch(exception excep) System.out.println("Throwing runtime error, please catch it -----"+excep);
132 SAMPLE SCREEN 132
133 Running Server Program 133
134 Running Client Program 134
135 135
136 Ex. No Advanced Java Programming Lab (J2EE) Login Form Validation using JavaBeans (Invisible Component) (HTML, JSP, JavaBeans) 136
137 UML NOTATION 137
138 SOURCE CODE <!..Login Validation..!> <html> <head> <title>login</title> </head> <body bgcolor="green"> <form action =" method="post"> <table border="5"> <th bgcolor="red">go Ahead</th> <tr> <Td> Enter USER NAME <input type="text" name="txt" title="user name" value="test"> </td> </tr> <tr> <Td> Enter PASSWORD <input type="password" name="txtt" title="password" value="test"> </td> </tr> 138
139 <tr> <td>          <input type="submit" name="mit" value="submit"> <input type="reset" name="res" value="reset"> <td> </tr> </table> </form> </body> </html> 139
140 SAMPLE SCREEN 140
141 SOURCE CODE <%!Login JSP %> <jsp:usebean id="log" class="beanpkg.mylogbean" scope="request"/> <jsp:setproperty name="log" property="*"/> <html> <head> <title>login asp</title> <head> <body> <% String fs=request.getparameter("txt"); String ss=request.getparameter("txtt"); int i; String x=log.check(); if(x=="yes valid") out.println("<font size=12 color=grey><u>secret Revealed</u></font><br>"); 141
142 for(i=0;i<fs.length();i++) if(i%2==0) out.println("<font color=red size="+fs+">"+fs.charat(i)); else out.println("<font color=blue size="+fs+">"+fs.charat(i)); out.println("<br>"); for(i=0;i<ss.length();i++) if(i%2==0) out.println("<font color=green size="+fs+">"+ss.charat(i)); else out.println("<font color=violet size="+fs+">"+ss.charat(i)); else out.println("fill values on your own by clearing the text boxes,<a href= GO BACK TO FILL</a>"); %> </body> </html> 142
143 SOURCE CODE // bean class defined here package beanpkg; import java.beans.*; import java.io.serializable; public class MyLogBean extends Object implements Serializable private String str1,str2; private int n; public MyLogBean() public void settxt(string val) str1=val; public void settxtt(string val) str2=val; public String check()throws Exception 143
144 if((str1.equals("test")) (str2.equals("test"))) return "Not Valid"; else return "yes valid"; 144
145 SAMPLE SCREEN 145
146 146
CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS. To create a servlet program to display the students marks
CREATE A SERVLET PROGRAM TO DISPLAY THE STUDENTS MARKS DATE: 30.9.11 Aim: To create a servlet program to display the students marks Hardware requirements: Intel Core 2 Quad 2GB RAM Software requirements:
More informationChapter #1. Program to demonstrate applet life cycle
Chapter #1. Program to demonstrate applet life cycle import java.applet.applet; import java.awt.*; public class LifeCycle extends Applet{ public void init(){ System.out.println(" init()"); public void
More informationTo create a view for students, staffs and courses in your departments using servlet/jsp.
Aim To create a view for students, staffs and courses in your departments using servlet/jsp. Software Requirements: Java IDE Database Server JDK1.6 Netbean 6.9/Eclipse MySQL Tomcat/Glassfish Login Form
More informationSWE642 Oct. 22, 2003
import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.util.arraylist; DataServlet.java /** * First servlet in a two servlet application. It is responsible
More informationJavaServer Pages (JSP)
JavaServer Pages (JSP) The Context The Presentation Layer of a Web App the graphical (web) user interface frequent design changes usually, dynamically generated HTML pages Should we use servlets? No difficult
More informationDevelop an Enterprise Java Bean for Banking Operations
Develop an Enterprise Java Bean for Banking Operations Aim: Develop a Banking application using EJB3.0 Software and Resources: Software or Resource Version Required NetBeans IDE 6.7, Java version Java
More informationM.Tech. CSE - I Yr I Semester (19)
M.Tech. CSE - I Yr I Semester - 2010-11 (19) //service public ServletConfig getservletconfig() return sc; public String getservletinfo() return "Guide - T.PoornaShekhar, M.Tech CS & CSE Coordinator - www.scce.ac.in";
More informationServletConfig Interface
ServletConfig Interface Author : Rajat Categories : Advance Java An object of ServletConfig is created by the web container for each servlet. This object can be used to get configuration information from
More informationJdbcResultSet.java. import java.sql.*;
1)Write a program to display the current contents of the tables in the database where table name is Registration and attributes are id,firstname,lastname,age. JdbcResultSet.java import java.sql.*; public
More informationPrinciples and Techniques of DBMS 6 JSP & Servlet
Principles and Techniques of DBMS 6 JSP & Servlet Haopeng Chen REliable, INtelligent and Scalable Systems Group (REINS) Shanghai Jiao Tong University Shanghai, China http://reins.se.sjtu.edu.cn/~chenhp
More informationChettinad College of Engineering and Technology CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY
CHETTINAD COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND TECHNOLOGY UNIT IV SERVLETS 1. What is Servlets? a. Servlets are server side components that provide a powerful mechanism
More informationAJP. CHAPTER 5: SERVLET -20 marks
1) Draw and explain the life cycle of servlet. (Explanation 3 Marks, Diagram -1 Marks) AJP CHAPTER 5: SERVLET -20 marks Ans : Three methods are central to the life cycle of a servlet. These are init( ),
More informationStateless -Session Bean
Stateless -Session Bean Prepared by: A.Saleem Raja MCA.,M.Phil.,(M.Tech) Lecturer/MCA Chettinad College of Engineering and Technology-Karur E-Mail: asaleemrajasec@gmail.com Creating an Enterprise Application
More informationUnit-4: Servlet Sessions:
4.1 What Is Session Tracking? Unit-4: Servlet Sessions: Session tracking is the capability of a server to maintain the current state of a single client s sequential requests. Session simply means a particular
More information3. The pool should be added now. You can start Weblogic server and see if there s any error message.
CS 342 Software Engineering Lab: Weblogic server (w/ database pools) setup, Servlet, XMLC warming up Professor: David Wolber (wolber@usfca.edu), TA: Samson Yingfeng Su (ysu@cs.usfca.edu) Setup Weblogic
More informationHandout 31 Web Design & Development
Lecture 31 Session Tracking We have discussed the importance of session tracking in the previous handout. Now, we ll discover the basic techniques used for session tracking. Cookies are one of these techniques
More informationServlet. Web Server. Servlets are modules of Java code that run in web server. Internet Explorer. Servlet. Fire Fox. Servlet.
Servlet OOS Lab Servlet OOS Servlets are modules of Java code that run in web server. Internet Explorer Web Server Fire Fox Servlet Servlet Servlet Java Application 2 Servlet - Example OOS import java.io.*;
More informationCIS 3952 [Part 2] Java Servlets and JSP tutorial
Java Servlets Example 1 (Plain Servlet) SERVLET CODE import java.io.ioexception; import java.io.printwriter; import javax.servlet.servletexception; import javax.servlet.annotation.webservlet; import javax.servlet.http.httpservlet;
More informationJ2EE Web Development 13/1/ Application Servers. Application Servers. Agenda. In the beginning, there was darkness and cold.
1. Application Servers J2EE Web Development In the beginning, there was darkness and cold. Then, mainframe terminals terminals Centralized, non-distributed Agenda Application servers What is J2EE? Main
More information1 GUI GUI GUI GUI GUI. GUI(Graphical User Interface) JDK java.awt. ? Component
99 6 1999.10.13 0 GUI GUI JDK 1.1 GUI 1 GUI GUI GUI(Graphical User Interface) GUI (GUI ) / ( GUI ) Java GUI JDK 1.1 1.2 1.2 Swing 1.1 java.awt GUI? Component setbounds(int, int, int, int) (x,y) setforeground(color)
More informationBackend. (Very) Simple server examples
Backend (Very) Simple server examples Web server example Browser HTML form HTTP/GET Webserver / Servlet JDBC DB Student example sqlite>.schema CREATE TABLE students(id integer primary key asc,name varchar(30));
More informationWeb based Applications, Tomcat and Servlets - Lab 3 -
CMPUT 391 Database Management Systems Web based Applications, - - CMPUT 391 Database Management Systems Department of Computing Science University of Alberta The Basic Web Server CMPUT 391 Database Management
More informationINTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M 1.B HTML FORM CREATION - 2 M
INTERNET PROGRAMMING TEST-3 SCHEME OF EVALUATION 1.A 3 LIFE CYCLE METHODS - 3M EXPLANATION - 1.B HTML FORM CREATION - 2 M SERVLET CODE IN POST METHOD IMPORT STATEMENTS - CLASS NAME AND METHOD (POST) -
More informationSession 8. JavaBeans. Reading & Reference. Reading. Reference. Session 8 Java Beans. 2/27/2013 Robert Kelly, Head First Chapter 3 (MVC)
Session 8 JavaBeans 1 Reading Reading & Reference Head First Chapter 3 (MVC) Reference JavaBeans Tutorialdocs.oracle.com/javase/tutorial/javabeans/ 2 2/27/2013 1 Lecture Objectives Understand how the Model/View/Controller
More informationSession 10. Form Dataset. Lecture Objectives
Session 10 Form Dataset Lecture Objectives Understand the relationship between HTML form elements and parameters that are passed to the servlet, particularly the form dataset 2 10/1/2018 1 Example Form
More informationAdvanced Internet Technology Lab # 4 Servlets
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 4 Servlets Eng. Doaa Abu Jabal Advanced Internet Technology Lab # 4 Servlets Objective:
More informationWHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD
W HI TEPAPER www. p rogres s.com WHITE LABELING IN PROGRESS ROLLBASE PRIVATE CLOUD In this whitepaper, we describe how to white label Progress Rollbase private cloud with your brand name by following a
More informationScheme G Sample Question Paper Unit Test 2
Scheme G Sample Question Paper Unit Test 2 Course Name: Computer Engineering Group Course Code: CO/CD/CM/CW/IF Semester: Sixth Subject Title: Advanced Java Programming Marks: 25 Marks 17625 ---------------------------------------------------------------------------------------------------------------------------
More informationCE212 Web Application Programming Part 3
CE212 Web Application Programming Part 3 30/01/2018 CE212 Part 4 1 Servlets 1 A servlet is a Java program running in a server engine containing methods that respond to requests from browsers by generating
More informationJava Enterprise Edition. Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1
Java Enterprise Edition Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 1 Java Beans Java EE Oct Dec 2016 EFREI/M1 Jacques André Augustin Page 2 Java Bean POJO class : private Attributes public
More informationSession 9. Introduction to Servlets. Lecture Objectives
Session 9 Introduction to Servlets Lecture Objectives Understand the foundations for client/server Web interactions Understand the servlet life cycle 2 10/11/2018 1 Reading & Reference Reading Use the
More informationIntroduction. This course Software Architecture with Java will discuss the following topics:
Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations
More informationSREE CHAITANYA COLLEGE OF ENGINEERING
SREE CHAITANYA COLLEGE OF ENGINEERING COMPUTER SCIENCE & ENGINEERING WT LAB MANUAL ( R13 REGULATION) 1. Install the following on the local machine a. Apache Web Server b. Tomcat Application Server locally
More informationA.1 JSP A.2 JSP JSP JSP. MyDate.jsp page contenttype="text/html; charset=windows-31j" import="java.util.calendar" %>
A JSP A.1 JSP Servlet Java HTML JSP HTML Java ( HTML JSP ) JSP Servlet Servlet HTML JSP MyDate.jsp
More informationIntroduction. Literature: Steelman & Murach, Murach s Java Servlets and JSP. Mike Murach & Associates Inc, 2003
Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Semester 2, 2015 Dr. Amin Beheshti Service Oriented Computing Group, CSE, UNSW Australia Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2411 1 Review:
More informationCOMP9321 Web Application Engineering
COMP9321 Web Application Engineering Java Server Pages (JSP) Dr. Basem Suleiman Service Oriented Computing Group, CSE, UNSW Australia Semester 1, 2016, Week 3 http://webapps.cse.unsw.edu.au/webcms2/course/index.php?cid=2442
More informationServlet 5.1 JDBC 5.2 JDBC
5 Servlet Java 5.1 JDBC JDBC Java DataBase Connectivity Java API JDBC Java Oracle, PostgreSQL, MySQL Java JDBC Servlet OpenOffice.org ver. 2.0 HSQLDB HSQLDB 100% Java HSQLDB SQL 5.2 JDBC Java 1. JDBC 2.
More informationWeb Technology for IE 20 November ISE 582: Information Technology for Industrial Engineering
ISE 582: Information Technology for Industrial Engineering Instructor: Elaine Chew University of Southern California Department of Industrial and Systems Engineering Lecture 11 JAVA Cup 10: Making Connections
More informationJ2ME With Database Connection Program
J2ME With Database Connection Program Midlet Code: /* * To change this template, choose Tools Templates * and open the template in the editor. package hello; import java.io.*; import java.util.*; import
More information2. Follow the installation directions and install the server on ccc. 3. We will call the root of your installation as $TOMCAT_DIR
Installing a Web Server 1. Install a sample web server, which supports Servlets/JSPs. A light weight web server is Apache Tomcat server. You can get the server from http://tomcat.apache.org/ 2. Follow
More information&' () - #-& -#-!& 2 - % (3" 3 !!! + #%!%,)& ! "# * +,
! "# # $! " &' ()!"#$$&$'(!!! ($) * + #!,)& - #-& +"- #!(-& #& #$.//0& -#-!& #-$$!& 1+#& 2-2" (3" 3 * * +, - -! #.// HttpServlet $ Servlet 2 $"!4)$5 #& 5 5 6! 0 -.// # 1 7 8 5 9 2 35-4 2 3+ -4 2 36-4 $
More informationSession 20 Data Sharing Session 20 Data Sharing & Cookies
Session 20 Data Sharing & Cookies 1 Reading Shared scopes Java EE 7 Tutorial Section 17.3 Reference http state management www.ietf.org/rfc/rfc2965.txt Cookies Reading & Reference en.wikipedia.org/wiki/http_cookie
More informationUnit III- Server Side Technologies
Web Technology Unit III- Server Side Technologies By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and not
More informationWelcome To PhillyJUG. 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation
Welcome To PhillyJUG 6:30-7:00 pm - Network, eat, find a seat 7:00-7:15 pm - Brief announcements 7:15-8:30 pm - Tom Janofsky's presentation Web Development With The Struts API Tom Janofsky Outline Background
More informationGetting started with Winstone. Minimal servlet container
Getting started with Winstone Minimal servlet container What is Winstone? Winstone is a small servlet container, consisting of a single JAR file. You can run Winstone on your computer using Java, and get
More informationsessionx Desarrollo de Aplicaciones en Red A few more words about CGI CGI Servlet & JSP José Rafael Rojano Cáceres
sessionx Desarrollo de Aplicaciones en Red José Rafael Rojano Cáceres http://www.uv.mx/rrojano A few more words about Common Gateway Interface 1 2 CGI So originally CGI purpose was to let communicate a
More informationJAVA SERVLET. Server-side Programming ADVANCED FEATURES
JAVA SERVLET Server-side Programming ADVANCED FEATURES 1 AGENDA RequestDispacher SendRedirect ServletConfig ServletContext ServletFilter SingleThreadedModel Events and Listeners Servlets & Database 2 REQUESTDISPATCHER
More informationChapter 10. IO Streams
Chapter 10 IO Streams Java I/O The Basics Java I/O is based around the concept of a stream Ordered sequence of information (bytes) coming from a source, or going to a sink Simplest stream reads/writes
More informationEXPERIMENT- 9. Login.html
EXPERIMENT- 9 To write a program that takes a name as input and on submit it shows a hello page with name taken from the request. And it shows starting time at the right top corner of the page and provides
More informationKamnoetvidya Science Academy. Object Oriented Programming using Java. Ferdin Joe John Joseph. Java Session
Kamnoetvidya Science Academy Object Oriented Programming using Java Ferdin Joe John Joseph Java Session Create the files as required in the below code and try using sessions in java servlets web.xml
More informationUniversité Antonine - Baabda
Université Antonine - Baabda Faculté d ingénieurs en Informatique, Multimédia, Systèmes, Réseaux et Télécommunications Applications mobiles (Pocket PC, etc ) Project: Manipulate School Database Préparé
More informationServlets by Example. Joe Howse 7 June 2011
Servlets by Example Joe Howse 7 June 2011 What is a servlet? A servlet is a Java application that receives HTTP requests as input and generates HTTP responses as output. As the name implies, it runs on
More information********************************************************************
******************************************************************** www.techfaq360.com SCWCD Mock Questions : Servlet ******************************************************************** Question No :1
More informationComponent Based Software Engineering
Component Based Software Engineering Masato Suzuki School of Information Science Japan Advanced Institute of Science and Technology 1 Schedule Mar. 10 13:30-15:00 : 09. Introduction and basic concepts
More informationAdvanced Internet Technology Lab # 5 Handling Client Requests
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2011 Advanced Internet Technology Lab # 5 Handling Client Requests Eng. Doaa Abu Jabal Advanced Internet Technology Lab
More informationDatabase Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실
데이타베이스시스템연구실 Database Systems Lab. 11. JSP I 충남대학교컴퓨터공학과 데이타베이스시스템연구실 Overview http://www.tutorialspoint.com/jsp/index.htm What is JavaServer Pages? JavaServer Pages (JSP) is a server-side programming
More informationOnline Book Services
Online Book Services Thong Ngo Shahzad Aziz ABSTRACT We have recognized the rapid growth of online service which is showed to be one of the most successful types of business these days. One clear evidence
More informationJava4570: Session Tracking using Cookies *
OpenStax-CNX module: m48571 1 Java4570: Session Tracking using Cookies * R.G. (Dick) Baldwin This work is produced by OpenStax-CNX and licensed under the Creative Commons Attribution License 4.0 Abstract
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationChapter 2 How to structure a web application with the MVC pattern
Chapter 2 How to structure a web application with the MVC pattern Murach's Java Servlets/JSP (3rd Ed.), C2 2014, Mike Murach & Associates, Inc. Slide 1 Objectives Knowledge 1. Describe the Model 1 pattern.
More informationAccessing EJB in Web applications
Accessing EJB in Web applications 1. 2. 3. 4. Developing Web applications Accessing JDBC in Web applications To run this tutorial, as a minimum you will be required to have installed the following prerequisite
More informationUnit III- Server Side Technologies
Web Technology Unit III- Server Side Technologies By Prof. B.A.Khivsara Note: The material to prepare this presentation has been taken from internet and are generated only for students reference and not
More informationEnterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets
ID2212 Network Programming with Java Lecture 10 Enterprise Java Technologies (Part 1 of 3) Component Architecture. Overview of Java EE. Java Servlets Leif Lindbäck, Vladimir Vlassov KTH/ICT/SCS HT 2015
More informationJava TM. JavaServer Faces. Jaroslav Porubän 2008
JavaServer Faces Jaroslav Porubän 2008 Web Applications Presentation-oriented Generates interactive web pages containing various types of markup language (HTML, XML, and so on) and dynamic content in response
More informationCSC309: Introduction to Web Programming. Lecture 10
CSC309: Introduction to Web Programming Lecture 10 Wael Aboulsaadat WebServer - WebApp Communication 2. Servlets Web Browser Get servlet/serv1? key1=val1&key2=val2 Web Server Servlet Engine WebApp1 serv1
More informationICOM 5016 Database Systems. Database Users. User Interfaces and Tools. Chapter 8: Application Design and Development.
Chapter 8: Application Design and Development ICOM 5016 Database Systems Web Application Amir H. Chinaei Department of Electrical and Computer Engineering University of Puerto Rico, Mayagüez User Interfaces
More informationApplet. 1. init (): called once by the applet containers when an applet is loaded for execution.
)*(applet classes from class JApplet. Applet Applet : are Java programs that are typically embedded in HTML (Extensible Hyper- Text Markup Language) documents. 2.Life cycle method : 1-init () 2-start ()
More informationJava Server Pages. JSP Part II
Java Server Pages JSP Part II Agenda Actions Beans JSP & JDBC MVC 2 Components Scripting Elements Directives Implicit Objects Actions 3 Actions Actions are XML-syntax tags used to control the servlet engine
More informationUniversité du Québec à Montréal
Laboratoire de Recherches sur les Technologies du Commerce Électronique arxiv:1803.05253v1 [cs.se] 14 Mar 2018 Université du Québec à Montréal How to Implement Dependencies in Server Pages of JEE Web Applications
More informationJava servlets CSCI 470: Web Science Keith Vertanen Copyright 2013
Java servlets CSCI 470: Web Science Keith Vertanen Copyright 2013 Overview Dynamic web content genera2on (thus far) CGI Web server modules Server- side scrip2ng e.g. PHP, ASP, JSP Custom web server Java
More informationAdvanced Topics in Operating Systems. Manual for Lab Practices. Enterprise JavaBeans
University of New York, Tirana M.Sc. Computer Science Advanced Topics in Operating Systems Manual for Lab Practices Enterprise JavaBeans PART III A Web Banking Application with EJB and MySQL Development
More informationJBu ilder. Building WAP-enabled Applications with JBuilder and Inprise Application Server. Introduction
Building WAP-enabled Applications with JBuilder and Inprise Application Server Introduction This document demonstrates how to provide WAP access into an enterprise application, in this case using EJB in
More informationJAVA SERVLET. Server-side Programming INTRODUCTION
JAVA SERVLET Server-side Programming INTRODUCTION 1 AGENDA Introduction Java Servlet Web/Application Server Servlet Life Cycle Web Application Life Cycle Servlet API Writing Servlet Program Summary 2 INTRODUCTION
More informationUnit 4 - Servlet. Servlet. Advantage of Servlet
Servlet Servlet technology is used to create web application, resides at server side and generates dynamic web page. Before Servlet, CGI (Common Gateway Interface) was popular as a server-side programming
More informationWeb Applications 2. Java EE Martin Klíma. WA2 Slide 1
Web Applications 2 Java EE Martin Klíma Slide 1 Web Application Architecture App 1 request Thin client (HTML) HTTP response controller model (JavaBea n) view (HTML) HTML generator Data App 2 App 3 Data
More informationユーザー入力およびユーザーに 出力処理入門. Ivan Tanev
プログラミング III 第 5 回 :JSP 入門. ユーザー入力およびユーザーに 出力処理入門 Ivan Tanev 講義の構造 1.JSP 入門 2. ユーザー入力およびユーザーに出力処理入門 3. 演習 2 Lecture3_Form.htm 第 3 回のまとめ Web サーバ Web 1 フォーム static 2 Internet サ3 ーブレ4 HTML 5 ットテキスト dynamic
More informationServlet. 1.1 Web. 1.2 Servlet. HTML CGI Common Gateway Interface Web CGI CGI. Java Applet JavaScript Web. Java CGI Servlet. Java. Apache Tomcat Jetty
1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C Java Applet JavaScript Web CGI HTML 1.2 Servlet Java Servlet Servlet CGI Web CGI 1 Java Java JVM Java
More informationIntroduction. This course Software Architecture with Java will discuss the following topics:
Introduction This course Software Architecture with Java will discuss the following topics: Java servlets Java Server Pages (JSP s) Java Beans JDBC, connections to RDBMS and SQL XML and XML translations
More informationBeans and HTML Forms. Usually Beans are used to represent the data of HTML forms
Beans and HTML Forms Usually Beans are used to represent the data of HTML forms Example: Name Form jsp Processong form using a bean jsp Processing form using
More informationSocket Programming(TCP & UDP) Sanjay Chakraborty
Socket Programming(TCP & UDP) Sanjay Chakraborty Computer network programming involves writing computer programs that enable processes to communicate with each other across a computer network. The endpoint
More informationDatabase Application Development
Database Application Development CPS352: Database Systems Simon Miner Gordon College Last Revised: 10/4/12 Agenda Check-in Application UI and the World Wide Web Database Access from Applications Design
More informationINTRODUCTION TO SERVLETS AND WEB CONTAINERS. Actions in Accord with All the Laws of Nature
INTRODUCTION TO SERVLETS AND WEB CONTAINERS Actions in Accord with All the Laws of Nature Web server vs web container Most commercial web applications use Apache proven architecture and free license. Tomcat
More informationa. Jdbc:ids://localhost:12/conn?dsn=dbsysdsn 21. What is the Type IV Driver URL? a. 22.
Answers 1. What is the super interface to all the JDBC Drivers, specify their fully qualified name? a. Java.sql.Driver i. JDBC-ODBC Driver ii. Java-Native API Driver iii. All Java Net Driver iv. Java Native
More informationServlet Basics. Agenda
Servlet Basics 1 Agenda The basic structure of servlets A simple servlet that generates plain text A servlet that generates HTML Servlets and packages Some utilities that help build HTML The servlet life
More informationModule 4: SERVLET and JSP
1.What Is a Servlet? Module 4: SERVLET and JSP A servlet is a small Java program that runs within a Web server. Servlets receive and respond to requests from Web clients, usually across HTTP, the Hyper
More informationIntroduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1
Introduction... xv SECTION 1: DEVELOPING DESKTOP APPLICATIONS USING JAVA Chapter 1: Getting Started with Java... 1 Introducing Object Oriented Programming... 2 Explaining OOP concepts... 2 Objects...3
More informationIntroduction. This course Software Architecture with Java will discuss the following topics.
Introduction This course Software Architecture with Java will discuss the following topics. I Java servlets I Java Server Pages (JSP's) I Java Beans I JDBC, connections to RDBMS and SQL I XML and XML translations
More informationServlets. An extension of a web server runs inside a servlet container
Servlets What is a servlet? An extension of a web server runs inside a servlet container A Java class derived from the HttpServlet class A controller in webapplications captures requests can forward requests
More informationDEV BHOOMI INSTITUTE OF TECHNOLOGY. Department of Computer Science and Engineering. WEB-TECH Lab-PCS-852 LAB MANUAL
DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 4th Semester: 8th WEB-TECH Lab-PCS-852 LAB MANUAL Prepared By: HOD(CSE) DEV BHOOMI INSTITUTE OF TECHNOLOGY
More informationLab1: Stateless Session Bean for Registration Fee Calculation
Registration Fee Calculation The Lab1 is a Web application of conference registration fee discount calculation. There may be sub-conferences for attendee to select. The registration fee varies for different
More informationPARTIAL Final Exam Reference Packet
PARTIAL Final Exam Reference Packet (Note that some items here may be more pertinent than others; you'll need to be discerning.) Example 1 - St10CommonImportTop.jsp (with comments removed)
More information1.264 Lecture 15. Web development environments: JavaScript Java applets, servlets Java (J2EE) Active Server Pages
1.264 Lecture 15 Web development environments: JavaScript Java applets, servlets Java (J2EE) Active Server Pages Development environments XML, WSDL are documents SOAP is HTTP extension UDDI is a directory/registry
More informationCopyright 2005, by Object Computing, Inc. (OCI). All rights reserved. Database to Web
Database To Web 10-1 The Problem Need to present information in a database on web pages want access from any browser may require at least HTML 4 compatibility Want to separate gathering of data from formatting
More informationWeb Programming. Lecture 11. University of Toronto
CSC309: Introduction to Web Programming Lecture 11 Wael Aboulsaadat University of Toronto Servlets+JSP Model 2 Architecture University of Toronto 2 Servlets+JSP Model 2 Architecture = MVC Design Pattern
More informationSession 8. Introduction to Servlets. Semester Project
Session 8 Introduction to Servlets 1 Semester Project Reverse engineer a version of the Oracle site You will be validating form fields with Ajax calls to a server You will use multiple formats for the
More informationAdvanced Java Programming
Advanced Java Programming Length: 4 days Description: This course presents several advanced topics of the Java programming language, including Servlets, Object Serialization and Enterprise JavaBeans. In
More informationServlet and JSP Review
2006 Marty Hall Servlet and JSP Review A Recap of the Basics 2 JSP, Servlet, Struts, JSF, AJAX, & Java 5 Training: http://courses.coreservlets.com J2EE Books from Sun Press: http://www.coreservlets.com
More informationLab session Google Application Engine - GAE. Navid Nikaein
Lab session Google Application Engine - GAE Navid Nikaein Available projects Project Company contact Mobile Financial Services Innovation TIC Vasco Mendès Bluetooth low energy Application on Smart Phone
More informationAuthor - Ashfaque Ahmed
Complimentary material for the book Software Engineering in the Agile World (ISBN: 978-1983801570) published by Create Space Independent Publishing Platform, USA Author - Ashfaque Ahmed Technical support
More information