P. 1
Web Programming

Web Programming

|Views: 568|Likes:
Published by Dark_Knight143

More info:

Published by: Dark_Knight143 on May 21, 2012
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

11/27/2012

pdf

text

original

WEB PROGRAMMING PART – A 5x5 - 25 Marks 1) What is Web? Explain GET and POST methods.

A:- WEB:- The web is a complex, international, cross platform, cross language, cross cultural mesh of servers, clients, users, databases, and quite a few artificial intelligences all talking, working, searching, viewing, accessing, downloading, and who knows what else. Web is not a thing, but as a process, an action, a medium of communication (fig on page 2). GET method:- The foundation of HTTP/0.9 (the first implementation of the HTTP protocol) was thee defination of the GET method that was used by a web browser to request a specific document. POST method:- The POST method allows web browsers to send an unlimited amoount of data to a web server by allowing them to tag it on an HTTP request after the request headers as the message body. 2) What is HTML? List the different classification of HTML tags. A:- HTML (Hyper Text Markup Language) is simply a markup language, which is used to describe the logical structure of a document. Classification of HTML:3) What is CSS? Why it is required? A:- CSS stands for Cascading style sheets. CSS is the part of DHTML that controls the look and placement of the elements on a page. With CSS we can basically set any style property of any element on a HTML page. One of the biggest advantages with CSS instead of the regular way of changing the look of elements is that we split content from design. If we want to change like the font size of our main text we just change it in the CSS file and all pages are updated. In CSS program always place the style tag inside the head of document. The syntax for CSS code is basically like this: <style type=”text/css”> ELEMENT{property1:value1; property:value2} </style> 4) List the steps in implementing a servlet. A:- Following are the steps used in implementing a servlet for HTTP communication: 1. Import required servlet packages in the class. 2. Make the class extend HttpServlet. 3. Override methods doGet(), doPost(), or doService() as required by problem in hand. 4. Make an entry for the above servlet in deployment descriptor. 5. Configure any extra options or filters, which are required by the server to function. 5) a)What is SSL? Why do we require SSL. A:- SSL stands for Secure Scokets Layer. SSL is a protocol. It is developed by Netscape, has become the universal standrad on the Web for authenticating Web sites to Web browser users, and for encrypting communications between browser user and Web servers. We required SSl is to provide security for Web traffic. Security includes confidentiality, message integrity, and autentication. SSL is built into all major n\browsers and Web servers, simply installing a digital certificate, or Server ID, enables SSL capabilites.

DHTML isn‟t really a language or a “thing” in itself it‟s just a mix of those technologies. server. and user input is placed and made available through globally accessible variables known as CGI environment variables. SERVER_PROTOCOL: The name of and revision of the information protocol that the request came in with.There are two most important building blocks of web: 1) HTML and 2) HTTP. It is a language. Servlet. A client/server system works something like this: A big piece of computer (called a server) sits in some office somewhere with a bunch of files that people might want access to. and retrieve it when you need it. 8) What are Cookies ? List any 6 Javax. HTML: . Actually. HTML cant be done after the page loads. Programming languages are “Turing-complete”. Typically programming languages use conditional branches and loops and operate on data contained in abstract data structures. HTTP: .String getValue(): Returns the value of the cookie . DHTML:. http Cookie methods.lang.Most of the information about the client. HTTP_USER_AGENT: The browser used by the client to issue the request. Following are the methods of the Cookie class: java. That is. programming languages can be used to compute something such as the square root of pi or some other such task. Some of the commonly used environment variables are: QUERY_STRING: The query information passed to the program. Now let us understand how client/server system works using HTTP. or “computable”. HTML is often called programming language it is really not. A:. 7) What are CGI environment variables? A:. CONTENT_LENGTH: The length of the data in bytes passed to the CGI program through the standard input.HTTP is a “request-response” type protocol.HTML stands for Hyper Text Markup Language. Dynamic HTML is simply HTML that can changes even after a page has been loaded into a browser. You can store information in a user‟s computer using cookies.lang. A:. DHTML can be used with JavaScript. 6) What are all the building elements of web ? A:.This is probably the most common way of tracking users on the Internet. HTML is a very simple language used to “describe” the logical structure of a document.HTML stands for Hyper Text Markup Language. It is a language spoken between web browser (client software) and a web server (server software) so that can communicate with each other and exchange files. This computer runs a software package that listens all day long to requests over the wires. HTML can be or not used with JavaScript.String getName(): Returns the name of the cookie java. HTML is much easier than all of that. The name value pairs are then stored in this environment variable. REQUEST_METHOD: The method with which the information request was issued. It is appended to the URL with a ? when the browser sends it to the server.HTML:.b) List the differences between HTML and DHTML.DHTML stands for Dynamic Hyper Text Madrkup Language. You can also specify how long the cookie should exist before being deleted by the browser. HTML is simply a „markup language‟ used to define a logical structure rather than compute anything.

} elsif ($query_string eq “finger”) { print „query string is finger„. just like a regular web page.machine/cgi-bin/name. and selections made by the user.String value): Assigns a new value to a cookie after it has been created void setPath(java. such as HTML tags. $query_string = $ENV{„QUERY_STRING‟}.pl and you will get different output.pl that uses QUERY_STRING to print the information passed. 10) What is JSP? How it is different from CGI programming? A: JSP stands for Java Server Pages. The information after the “?” character is known as a query string. by the name name. } else { print „invalid query string„.void setValue(java. You can execute this script as either: http://some.pl. The following is a CGI program called name. JSP defines a number of standard elements that are useful for any web application. A JSP page contains standard markup language elements.pl?fortune Up to the question mark (?). if ($query_string eq “fortune”) { print „query string is fortune„. It is a technology for developing web pages that include dynamic content.String uri): Sets the path for the cookie by which the browser will send the cookie void setMaxAge(int expiry): Set the maximum age of the cookie in seconds int getMaxAge(): Returns the maximum age of the cookie in second 9) Explain with example query string. such as retrieving information from a database or registering user preferences.machine/cgi-bin/name. A JSP page can change its content based on any number of variable items. #!/usr/local/bin/perl print “Content-type: text/plain”. information provided by the user. the user‟s browser type. it calls the CGI program identified in the first part of the URL (before the “?”) and then stores the part after the “?” in the environment variable QUERY_STRING. When the server is passed a URL with a query string. .pl?finger or http://some.pl?fortune http://some. after a question mark. “\n\n”. You may have seen URLs like the following:http://some. What‟s new here is the part after the “?”. including the identity of the user.lang. JSP elements can be used for a variety of purposes. It is merely a CGI script being called.lang. } exit (0). 11) Explain with example the meaning of servlet. A:. 12) What is Java Script? List out uses of Java Script.machine/cgi-bin/name. JSP also contains special JSP elements that allow the server to insert dynamic content in the page. the URL should look familiar.machine/cgi-bin/name.One way to send form data to a CGI program is by appending the form information to the URL.

14) What is CGI ? Give examples of CGI application. VII. plain text. In the second case. They will have a parent node and possibly sibling nodes. This file may be a regular file or a program.Java script is a scripting language( like a simple programming language). while passing user-specific data to the program. The uses of JavaScript :I.A:. With JavaScript. When a web page is requested via the Hypertext Transfer Protocol. Some of the possible applications of CGI are: 1) Forms: . IV.CGI provides a solution to the problem in the form of a gateway. JavaScript do not have any graphics capabilities. For security reasons.In the Worldwide Web. JavaScript is a language that can be used for client-side scripting. but they cannot have child nodes. client-side JavaScript does not allow the reading or writing of files. The program then processes that data and the server passes the program‟s response back to the Web browser. III. the . JavaScript is only used inside of HTML documents. a query string is the part of a Uniform Resource Locator (URL) that contains data to be passed to web applications such as CGI programs. Control document Appearance and Content Control the browser Interact with Document control Interact with User Read and Write Client State with Cookies Interact with Applets JavaScript is only used inside of HTML documents Disadvantages:I. we can format and send it to the client. we can make text scroll across the screen like ticker tape. V. We can create virtual HTML. 2) Gateways:. In this case. and even audio documents. or character data. II.Virtual. JavaScript does not support any kind of networking. 13) What are text nodes ? A:.CGI or “Common Gateway Interface” is a specification which allows web users to run programs from their computer. IV. They are created on the fly in response to a user‟s information request. VI. Once we have the information. 15) What is Query String ? A:. The forms interface makes Web browsing an interactive process for the user and the provider. The Web server can call up a program.One of the most prominent uses of CGI is in processing forms are subsets of HTML that allow the user to supply information forms. the CGI program servers as a gateway to the Oracle database. We can use a language such as oraperl or a DBI extension to Perl to form SQL queries to read the information contained within the database. II. image. 3) Virtual Documents:. III.Text nodes represent content. the server locates a file in its file system based on the requested URL. A:. CGI is the part of the Web server that can communicate with other programs running on the server. or dynamic documents creation is at the heart of CGI. JavaScript doesn‟t have any multithreading capabilities.

you can also pass additional data known as extra path information as part of the URL. The server gauges where the CGI program name ends. A:. JSP supports both scripting and element-based dynamic content and allows programmers to develop custom tag libraries to satisfy application-specific needs. Servlet applications are usually distributed as a WAR files. Application server: An application server commonly includes a web server so perhaps we can see an application server as an extension of a web server. 20) What is a war file? Give its importance. A:.This is an XML file describing the servlet and other components that make up your application. using a UNIX convention in which daemons are named with the name of the service followed by the letter “d”. A:. xml or application. Usually when we want to deploy EJBs we will go for App servers like web-logic or web-sphere. 19) Describe role of deployment descripters. Its use permits data to be passed from the HTTP client (often a web browser) to the program which generates the web page. 2). The ejb-jar. JSP pages are compiled for efficient server processing.pl/cgi_doc./ Give the Basic servlet structure. 23) What are servlets ? Describe with example. 3) JSP pages can be used in combination with servlets that handle the business logic. the model supported by Java servlet template engines.machine/cgi0bin/display.1). 18) List out differences between web server and application server.xml file is used as deployment descriptor.txt 17) What is a web server? What is a application server? A:. to specify a session timeout of 30 minutes use: <session-config> <session-timeout>30</session-timeout> </session-config> 22) What are the advantages of JSP ? A:. anything following that is deemed as extra path information and stored in the PATH_INFO environment variable. ejbjar.Besides passing query information to a CGI script.xml file is used as deployment descriptor. 21) How to specify session time out in Web. Most web servers on Internet today run on UNIX machines.xml or application.same of the above. By default.Web server: Web server is the software responsible for accepting browser requests.You can specify session timeout in the <session-timeout> attribute of the <session-config> element. A:. 16) What is Extra Path Information ? A:. along with any initialization parameters and container-managed security constraints that we want the server to enforce for us. retrieving its content & returning its content.XML? A:. For example the following line calls a script with extra path information: http://some. Web servers are often called httpd. Web servers first retrieve the request using Berkeley sockets. In application server you can deploy a java components ranging from simple java application to server side business components.WAR or Web Application Archive file is packaged servlet Web application. . For example.server may (depending on its configuration) run the program. Web browsers use port 80 for their requests.Servlets are programs that run on a Web server and build Web pages. sending its output as the required page. The query string is a part of the URL which is passed to the program. In application server. (q17).

are requests made by browsers when the user types in a URL on the address line. Cookies: . or makes an HTML from that does not specify a METHOD. DoGet and doPost are called by the service method. For simple servlets.servlet. HTTP request headers. .io .The two packages are: javax. Servelts can also very easily handle post requests. We have to import classes in java.servlet. We can also specify how long the cookie should exist before being deleted by the browser. PrintWriter used to headers and most importantly.The outline of a basic servlet that handles GET requests. HttpServletRequest has methods that find out about incoming information such as FORM data. GET requests. depending on whether the data is being sent by GET or by POST. and sometimes we want to override service directly.This is probably the most common way of tracking users on the Internet.http. These methods take two arguments: HttpServletRequest and HttpServletResponse. follows a link from a Web page. A class should extend HttpServlet and override doGet or doPost. javax. obtain a send output back to the client.http 25) What are the several ways of tracking users? A:. most of the effort is spent in println statements that generate the desired page. 24) Which two packages implement the servelet API ? A:. We can store information in a user‟s computer using cookies. HttpServletResponse has methods that specify the HTTP response line response.servlet . depending extend HttpServlet and override doGet or doPost. which are generated when someone creates an HTML form that specifies METHOD=”POST”.servlet 6. javax. and javax.The several Ways of tracking users are followings: Hidden text: It is easier way to associating information which is not directly associated to user. and retrieve it when we need it.

Occasionally. A:.  Frequently released newer versions of EJB specifications render application obsolete quickly. A:. The agreement is accomplished by implementing a set of Java interfaces from the EJB API. Session beans can be used to distribute and isolate processing tasks.Sessions are something the server offers us to support user tracking. 30) What is DTD ? . Preserve data between accesses to a Web page by the same user.breed solution  To handle fluctuations in resource demand server-side resource can easily be scaled by adding or removing servers. b)What are the advantages and disadvantages of EJBs. although they can take up a lot of resources on the server.Sessions are something the server offers us to support user tracking. JNDI (Java Naming and Directiory Interface). and component lifecycle management.Following are the advantages of EJBs:  Many vendor application server conform to the J2EE specification allowing you to select a best-of. although they can take up a lot of resources on the server. 26) What are the disadvantages of hidden controls? A:. Note that EJBs are not GUI components. 29) Describe in briefly the entity beans and session beans. Session Beans: Session beans are different from of entity beans in that they are not permanent objects. Entity Bean: An entity bean is an object with special properties: a) It is permanent: an entity bean stays around until it is deleted. Also. The tasks can be distributed on different machines. Session bean may perform a task of remote location. Session beans do not have a primary key. A program can create an entity bean then the program can be stopped and restarted. We can‟t store data between sessions. and hey‟re great. It involves a standardization agreement that enables a component to run within any application server.There are two kinds of Enterprise Java Beans. it is not very secure.  EJBs take time to develop. “Entity Beans” and “Session Beans”. Application:.  Application servers provide access to complex services.Storing data in hidden controls works. A:. the bug may not be in your code but in the application server itself. b) It is network based: an entity bean can be used by any program on the network.Enterprise Java Beans (EJB) is a server-side component that executes specific business logic on a server when invoked by a local or remote client. It is executed remotely: an entity bean run on a “server” machine. they are difficult to debug. It is identified by a primary key: The primary key is unique. EJB is actually a framework for writing distributed programs. resource pooling. 27) What is sessions? A:. Sessions preserve data between accesses to a Web page by the same user.Sessions: . and they‟re great. Session bean can be used to perform a certain task on behalf of its client.Data can be shard using application can be used to track multiple users at same time. each entity bean is uniquely identified by its primary key. Following are the disadvantages of EJBs:  EJB has a large and complicated specification. and the data stored in those controls is visible if the user views the page‟s HTML source. 28) a) Give an overview about EJBs. such as transaction and security management.

PART – B 5x 15 =75 Marks 1) a) Why do we require Java script and DHTML.CGI stands for Common Gateway Interface. All CGI appliations must translate the needs of clients into server requests.<br> &lt. It is a schema specification method for XML.A:. CGI provides a “gateway” between a human user with unexpected and complex needs.DTD or Document Type Definitions is a document that contains grammar rules for validating an XML document. Below is an example of <u>HTML code</u><br> <code> &lt. JavaScript can be used to prompt the user to enter a value in that field. </body> . 7 Marks A: . With CGI. It cannot process data and is therefore not interactive. which is filled by user and responding to the client in the form of dynamically generated HTML.HEAD&gt.JavaScript and DHTML make Web pages more interactive.<br> &lt. 8 Marks A:. 7 Marks A:. comand/logic oriented srever./HTML&gt. b) What is CGI? Explain the role of CGI programming in web. For example. JavaScript can be used to write programs for creating interactive Web pages. The CGI script will be responsible for processing the form data. DHTML can be used to make the pages more interactive by allowing you set properties of Web pages and their look and feel. the web server can call up a program. HTML can be used to only present information.<br> &lt. and a powerful. 2) a) Write an HTML program to demonstrate text characteristics tags./HEAD&gt.<br> </code> <p><kbd>&</kbd> followed by <kbd>gt</kbd> represents the greater than sign. or input the user has supplied using HTML from syntax). CGI is the part of the Web server that can communicate with other programs runining on the server. The program then processes that data and the server passes the program‟s response back to the WEB browser. while passing user-specific data to the program ( such as what host the user is connecting from. if a user leaves out a field in an online form.HTML&gt.The following code demonstrates some of the important text characteristics tags in HTML: <html> <head> <title>Text Characteristics</title> </head> <body> <p><b> <font color = "#0000FF" face ="Arial" size = "5"> Text Characteristics in </font> <font color = "#0000FF" face ="Arial" size = "8"> <s>HTML</s> </b> </p> </font> <i>HTML</i> is a <em>formatting language</em> for Web pages. and translate server replies into meaningful well-presented “answer”.

retrieving the specified file or executing the script.<html> <head> <title>Pop up</title> </head> <body onclick = "window. you can also specify where the script is expected to run using the runat attribute. You can specify the scripting language in the script tags' Language attribute. The script tag marks the beginning and end of JavaScript in a web page. to load an image from a URL. 7 A:.chapter 4 of book. you can use the script tag as: <SCRIPT Language = "JavaScript" runat = "server"> </SCRIPT> b) Write a program to display text in status bar on click of a button.status = 'You have clicked!!!'"> <h1>Changing Status Bar Text</h1> </body> </html> 4) a) Write a CGI application which accepts 3 numbers and display biggest number. For example.b) Explain how you can embed an image in HTML page? Give an example. you can specify the URL in the SRC attribute. when JavaScript is used as a server side scripting language.(page 90-91 of book) 5) a) What is Web Server? Explain briefly the mechanism of web server. 7 Marks A:.gif) that you want to embed resides in the same folder as the HTML page. Popular Web servers .The Web server is the software responsible for accepting browsers' requests.JavaScript is a scripting language (like a simple programming language). 7 Marks A:.Java script:. 8 Marks A:. we can make text scroll across the screen like ticker tape. if the image (suppose image_filename. for embedding and formatting images in an HTML page. JavaScript is a language that can be used for client-side scripting. JavaScript is only used inside of HTML documents. 8 Marks A:. The most common attributes of the <IMG> tag are: SRC: Absolute or relative path of the image to be embedded LOWSRC: The path of the low resolution version the image ALT: Alternate text to be displayed in case the image cannot be loaded. 3) a) What is Java script? Explain the usage of script tags. Similarly. you can use the <IMG> tag. you can embed it as: <IMG SRC="image_filename. In case this image cannot be loaded.gif. b) With the help of an example explain extra path information. the text "this is an image loaded from a relative path" will be displayed. In addition. The <IMG> tag includes various attributes.To embed an image in an HTML page. ALIGN : Alignment of the image in the page HEIGHT: Height of the image WIDTH: Width of the image You can use the above tags to load an image from a URL or a relative path. For example. 8 Marks A:. With JavaScript. and returning its content to the browser.gif" ALT = "this is an image loaded from a relative path"> The above will display the image in the file image_filename.

info. import. include directive: Used to insert text and/or code at the JSP translation time. 7 Marks A:. The server sends the contents of the file back to the client. The Web server listens for request on a particular port on the server machine. then the server retrieves /usr/local/httpd/htdocs/staff/matthew. 8 Marks A:. For HTTP request. session. The most common method of this object is out. request. which is a mechanism used for communicating over a network. buffer. errorPage. Its syntax is: <%@ include file = "relativeURLspec" %>.A Web server first retrieves a client request using Berkley sockets. The various possible attributes are language. response in a JSP Directives.JSP directives are JSP elements that provide global information about a JSP page. JSP is a technology for developing web page that include dynamic content. It looks for the file under the document root directory. . if the document root is /usr/local/httpd/htdocs and the client requests the document /staff/matthew.html. b) Explain implicit objects out. autoFlush.which prints text that will be displayed in the client's browser. along with some HTTP response headers. The various JSP directives are: page directive: Defines information that will globally affect the JSP containing the directive. If the URL does not specify a file but just a directory. taglib directive: States that the including page uses a custom tag library. Apache.html. isThreadSafe.Following are the implicit objects in a JSP page: out: This implicit object represents a JspWriter that provides a stream back to the requesting client. generally called index. this port is by default set to 80.include Tomcat. isErrorPage. which must be local to the Web application that contains the directive. For example. The file attribute can reference a normal HTML file or a JSP file. and contentType. 8 Marks 6) a) What is JSP? Explain the various JSP directives. extends.html. b) What is war file? Give its importance. The syntax of a page directive is: <%@ page {attribute = "value"}%>. and IIS. it locates the document being requested. uniquely identified by a URO and associated with a prefix that will distinguish each set of custom tags to be used in the page. JSP is use for change The various JSP directives:.println().JSP is stands for Java server Page. When the server receives the request.html or welcome. Mechanism of web server:. the server returns the directory index file. Its syntax is: <%@ taglib uri = "tagLibraryURI" prefix = "tagPrefix"%>.

HTTP is a “request-response” type protocol that specifies that a client will open a connection to a server then send a request using a very specific format. A common use of this object is writing HTML output back to the client browser. send it back over the wires to the “client” who . The request bject is associated with every HTTP request. 7 Marks b) Draw and explain the class diagram to show the relationships between the major classes in the servlet API. It should provide abstraction in obtaining requests and formatting responses and at least support communication over HTTP. Tomcat is a servlet container. which provides network services over which requests. You can do this by calling the request object's getParameter() method with the parameter name you are seeking. A client/server system works something like this: A server sits in some office somewhere with a bunch of files that people might want access to. This computer runs a software package that listens all day long to requests over the wires. HTTP is a language spoken between our web browser (client s/w) and a web server (server software) so that they can communicate with each other and exchange files.servlet.request: This implicit object represents the javax. Client/server system is a very eager way of distributing information across information systems like LAN. and behaviour for a servlet. One common use of the request object is to access request parameters. A servlet container is software. WAN. find the requested file.HttpServletRequest interface. 8 Marks A:- A servlet is a Java program. which outlines all necessary operations. For example. The “server software” will then accesses the server hardware. restrictions. The response bject is used to pass data back to the requesting client. 8) a) Explain how HTTP is used in client/server system. 7 A: . responses are sent. which runs in a servlet container and is written according to servlet API specification.HttpServletRequest object. Servlet API is a set of classes and interfaces. It will return a string with the values matching the named parameter.servlet. 7) a) Explain in detail servlet cycle. response: This implicit object represents the javax. or the Internet.

b) Static pages are easily read by search engine spider. and then wait for another request from the same or another client.</td> </tr> <tr bgcolor="#AB00FF"> <td width="33%">&nbsp.</td> <td width="34%">&nbsp. So that HTML is the language of the web.</td> <td width="33%">&nbsp. retrieving information from a database. HTML is a simply markup language used to define a logic structure rather than computer.a) The great numbers of web pages on the internet are static HTML pages but visitors find dynamically generated web pages because they are provide instant access to highly relevant information.</td> <td width="34%">&nbsp.The following is an HTML page containing a table 4 X 3 and each row colored differently: <html> <head> <title>Colored Table</title> </head> <body> <table border="1" width="100%"> <tr bgcolor="#0000FF"> <td width="33%">&nbsp.</td> <td width="33%">&nbsp. demonstrates the usage of anchor tags: <html> <head> <title>Anchor Tag Characteristics</title> . b) What are the differences between static and dynamic web pages ? 8 A:.The following HTML page.requested it.</td> </tr> </table> </body> </html> b) Create a simple HTML page to demonstrate the usage of Anchor tags.</td> <td width="34%">&nbsp.</td> <td width="34%">&nbsp.</td> </tr> <tr bgcolor="#00A0FF"> <td width="33%">&nbsp. 9) a) Write an example HTML page containing a table 4x3 and each row colored differently. 8 A:. It only focuses on describing is responsible for adding style. 7 A:. contain little actual text.</td> </tr> <tr bgcolor="#FB2CFF"> <td width="33%">&nbsp. Dynamic Web pages. They are created each time they are requested.</td> <td width="33%">&nbsp. Dynamic sites are also easy to update. c) Static web pages are simple text files that are displayed by your browser upon request.</td> <td width="33%">&nbsp. The beauty of HTML of route is that it is generic enough that it can be read and interpreted by a web browser running on any machine or o/s.

7 A:. $var_noval.PEARL:PERL variables are of the following three types:Scalars: A scalar variable stores a single value of any type. Arrays can be declared as: @emptyarr =().in" target= "_blank"> Search on Google</a>&nbsp. 11) a) What is PEARL ? Explain different types of PEARL variables.</p> <A NAME= "sec1">Section 1: </a> <p> <a href="http://google. 8 A:.DOM. is the interface that allows programmatically accessing and manipulating the contents of a web page or document. The DOM is the hierarchy of elements that are present in the browser at any given time. The Document Object Model is the real core of dynamic HTML..The Document Object Model. .com"> Shop on ebay&nbsp.co.</a></p> <p><a href="http://wallpapers. All of the above methods (except getElementsByTagName()) can only be used against the document object.com"> Order Custom T-Shirts News</a></p> </body> </html> 10) a) Explain document object model.</head> <body> <h1 align="center">All in One</h1> <p align="left">In <A HREF= "#sec1">section 1</a> you can search. Arrays: Arrays store an ordered list of values. Some methods are: getElementById().</p> <p><a href="http://yahoo. allowing us to create dynamic content The DOM also provides an interface for dealing with events. or DOM. Scalar variables are prefixed with a $. It makes HTML changeable. 8 A:. i. createAttribute(). You can define or use a variable as: $var =1. It also provides methods for adding and removing such objects. It provides a structured. In <A HREF= "#sec2">section 2</a> you can shop. createElement(). These variables need not be declared before using them. $str = "This is a scalar string variable".</p> <p><a href="http://t-shirts. getElementsByTagName().Methods for accessing and creating other nodes in the document tree. allowing to capture and respond to user or browser actions. using the syntax : document.</p> <p> <A NAME= "sec2">Section 2: </a> </p> <p><a href="http://ebay. createTextNode().methodName(). b) Explain the methods to access nodes in a document tree.e. objectoriented representation of the individual elements and content in a page with methods for retrieving and setting the properties of those objects.com">Search on Yahoo</a></p> <p>&nbsp. "2".com">Download wallpapers</a>&nbsp."3"). @arr = ("1".

or checkboxes.pm.jsp" METHOD = "POST/GET"> The name attribute specified the name for a form.an associative array or paired list of elements. An individual item of a Hash is referred to as $hs{"key1"}. Application server: commonly includes a web server so perhaps we can see an application server as an extension of a web server. 12) a) Explain the role of Deployment descriptors.Each individual item of an array is referred to by its index number as: print "$arr[0]". A form includes various other <INPUT> elements such as textbox. In application server.Web server:. these are called standard library modules and don‟t have to be installed. In application server you can deploy java components ranging from simple java application to sever side business components. 13) a) Explain the semantics of the HTML FORM element.This is an XML file describing the servlet and other components that make up your application. Each pair in a Hash consists of a string key and data value.-print “<h2>Hello.pm also has a number of functions that serve as HTML shortcuts.Perl offers a powerful feature to programmers: add-on modules. using a UNIX convention in which daemons are named with the name of the service followed by the letter “d”.xml file is used as deployment descriptor. Hashes: A Hash is a special kind of an array . Most web servers on internet today run on UNIX machines. Usually when we want to deploy EJBs we will go for App server like web logic or web-sphere.xml or application.is the software responsible for accepting browser requests. buttons. . Web browser use port 80 for their requests. Web servers first retrieve the request using Berkeley sockets. explain CGI.xml or application. #!/usr/bin/perl –wT -use CGI qw(:standard). The method can be POST or GET.-print end_html.The HTML form element represents a form in which users can input data and submit it to the server for processing.pm is implied in the use statement. 7 A:. Some modules are included as part of the Perl distribution. b) With the help of an example. We‟re not doing use CGI. You can use the push() and pop() functions to insert or delete an element from an array.pm but rather use CGI.-print start_html(“Hello World”). key2=> "val2"). The HTML form tag is as follows: <FORM NAME="name" ACTION = "action. "val2"). 8 A:. The action attribute specified the URL of the document or the name of the file to which the form data is submitted for action and the method attribute specified the HTTP method through which the data is sent to the server. The action attribute can be a simple static Web page or a servlet. By default. A hash is defined as: %emptyhs = (). "key2". retrieving its content & returning its content. 7 A:. The my function can be used with each of the above type of variables to declare and limit the scope of the variable to the enclosing block as: my $var. " 7 A:. ejb-jar. "val1".pm module. %hs = ("key1". list. The . These are collections of pre-written code that can use to do all kinds of tasks. The qw(:standard) part of this line indicates that we are importing the “standard” set of function from CGI. b) List out the differences between Webserver and application server. or%hs = (key1 => "val1". along with any initialization parameters and container-managed security constraints that we want the server to enforce for us. world!</h2>\n”.xml file is used as deployment descriptor. The ejb-jar. We can save the time and trouble of reinventing the wheel by using these modules.-print header. Web servers are often called httpd. CGI.

In CSS program always place the style tag inside the head of document. info. which must be local to the Web application that contains the directive. If servlet instance does not exist in memory. The syntax of a page directive is: <%@ page {attribute = "value"}%>.Following are the implicit objects in a JSP page: out: This implicit object represents a JspWriter that provides a stream back to the requesting client. and contentType.which prints text that will be displayed in the client's browser. the POST method can be used. 8 A: . import. If we want to change like the font size of our main text we just change it in the CSS file and all pages are updated. One common use of the request object is to access .HttpServletRequest interface. session. The complete transaction is invisible because to the client. Loads the servlet class and thus creates its instance b. 14) a) With the help of an example explain GET and POST Methods. The most common method of this object is out. 8 A:. Its syntax is: <%@ include file = "relativeURLspec" %>.When a client sends a request to the server. uniquely identified by a URO and associated with a prefix that will distinguish each set of custom tags to be used in the page. taglib directive: States that the including page uses a custom tag library. The various possible attributes are language.JSP directives are JSP elements that provide global information about a JSP page.b) Describe the request handling cycle and the methods invoked on the servlet by the servlet container. request response in a JSP page. The POST method sends the data as packets through a separate socket connection. One of the biggest advantages with CSS instead of the regular way of changing the look of elements is that we split content from design. isErrorPage. b) “HTML is the language of Web”.servlet. The additional sequence of characters that are appended to URL is called a query string. Moreover.Following are the operations done on a servlet by servlet container when a servlet is requested: 1. request: This implicit object represents the javax. The request object is associated with every HTTP request. extends. b) Explain implicit object out. the container: a. Calls the init() method on the above class and passes ServletConfig as parameter 2.println(). a) Explain various JSP directives. the length of the query string is limited to 240 characters. include directive: Used to insert text and/or code at the JSP translation time. On any further request service() method of servlet class is called and HttpServletRequest and HttpServletResponse are passed as parameters to it.property:value2} </style> 16). 7 A:. isThreadSafe. buffer. The various JSP directives are: page directive: Defines information that will globally affect the JSP containing the directive. errorPage. autoFlush. the clients can also additional information with URL to describe what exactly is required as output from the server by using the GET method.CSS stands for Cascading style sheets. To overcome these disadvantages. Explain 7 15) Explain CSS with the help of an example. 8 A:. With CSS we can basically set any style property of any element on a HTML page. CSS is the part of DHTML that controls the look and placement of the elements on a page. The disadvantage of POST method is that is slower compared to the GET method because data is sent to the server as separate packets. Its syntax is: <%@ taglib uri = "tagLibraryURI" prefix = "tagPrefix"%>. The file attribute can reference a normal HTML file or a JSP file. 7 A:. The syntax for CSS code is: <style type=”text/css”>Element{property1:value. the query string is visible on the browser and can therefore be a security risk. However.

A remote interface is the business end of EJB.SSL stands for Secure Sockets Layer. Note that EJBs are not GUI components. message integrity. A common use of this object is writing HTML output back to the client browser. and the Alert Protocol. .request parameters. whereas the server is the entity that responds to the client and negotiates which cipher suites are used for encryption. response: This implicit object represents the javax. When the session is initiated and the handshake is complete. The roles of remote and home interfaces in EJB: . It will return a string with the values matching the named parameter. 8 A:. the Handshake Protocol. The response object is used to pass data back to the requesting client. server and client. If there are any alarms at any point during the session. 7 A:.HttpServletRequest object. The main role of SSL is to provide security for Web traffic. EJB is actually a framework for writing distributed programs. 17) Which two packages implement the servlet APL ? 7 A:18) a) What is SSL? What is the necessity of it? Explain the working of SSL. Three protocols lie within SSL. or to find an existing instance of an EJB. and for encrypting communications between browser users and Web servers.EJB:. the alert is attached to the questionable packet and handled according to the Alert Protocol. has become the universal standard on the Web for authenticating Web sites to Web browser users. Since the processing code and the HTML elements are lumped together. the data transfer is encrypted during the Record Protocol phase. and authentication. there are no session bean finder methods. the Record Protocol. In SSL. The client authenticates the server during the Handshake Protocol. It is the set of services provided by EJB. the Web browser is the client and the Web-site server is the server. The client is the entity that initiates the transaction. It helps clients to create a new instance of an EJB. The methods used to find existing EJBs are shown as finder methods. You can do this by calling the request object's getParameter() method with the parameter name you are seeking. SSL is a protocol. It is developed by Netscape. The home interface is the book-keeping interface.Enterprise Java Beans (EJB) is a server-side component that executes specific business logic on a server when invoked by a local or remote client. b) What is EJB ? Briefly describe the roles of remote and home interfaces in EJB. Since session beans are not designed to be shareable. Security includes onfidentiality. 19) How are JSP’s are better than servlets? A:a) Java programming knowledge is needed to develop and maintain all aspects of the applicationb. The working of SSL is: SSL has two distinct entities.servlet. The agreement is accomplished by implementing a set of Java interfaces from the EJB API. It involves a standardization agreement that enables a component to run within any application server.

requires then servlet code to be update and recompiled.Sessions are something the server offers us to support user tracking. XML is a cross-platform. SSL is built into all major n\browsers and Web servers. has become the universal standrad on the Web for authenticating Web sites to Web browser users. c) It provides user-selected view of data. XML can be used to transfer structured data between various systems.b) Changing the look and feel of the application. A tag begins with a name sandwiched between less-than (<) and greater-than (>) characters. The agreement is accomplished by implementing a set of Java interfaces from the EJB API. error prone and extremely boring. It involves a standardization agreement that enables a component to run within any application server. If such tools are used to devlop the web page layout. h/w & s/w independent markup language. and for encrypting communications between browser user and Web servers. It is developed by Netscape. the generated HTML must then br manually embedded into the servlet code. or Server ID.SSL stands for Secure Scokets Layer. EJB is actually a framework for writing distributed programs. So jsp better than servlets 20) Write short note on the following 3x5= 15 Marks A)XML A:. d)Sessions A:. and autentication. Note that EJBs are not GUI components. c) SSL A:. Security includes confidentiality. XML represents information as text using tags to add structure. Preserve data between accesses to a Web page by the same user. c) It‟s hard to take advantage of web–page development tools when designing the applicaton interface. Adding JSP to the puzzel we solve therse problem. simply installing a digital certificate.Extensible markup language is a text-based markup language that enables to store data in a structured format by using meaningful tags. SSL is a protocol. a process which is time consuming. XML is extremely simple. Advantages of XML: a) it provides a way of creating domain-specific vocabulary.Enterprise Java Beans (EJB) is a server-side component that executes specific business logic on a server when invoked by a local or remote client. although they can take up a lot of resources on the server. B)EJB . and they‟re great.EJB:. b) It enables smart searches. We required SSl is to provide security for Web traffic. Xml is used as a common data interchanges format in a number of applications. message integrity. \ A:. . XML allows computers to store data in a format that can be interpreted by any other computer system. or adding support for a new type of client. enables SSL capabilites.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->