Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (1 vote)
71 views20 pages

ORAL Co-Ordination

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 20

Definitions -

Servlets are the Java programs that runs on the Java-enabled web server or application
server. They are used to handle the request obtained from the web server, process the
request, produce the response, then send response back to the web server.

JavaServer Pages (JSP) is a Java standard technology that enables you to write dynamic,
data-driven pages for your Java web applications. JSP is built on top of the Java Servlet
specification.

A scriptlet tag is used to execute java source code in JSP. Syntax is as follows:
<% java source code %>

In this JSP tags are used to insert JAVA code into HTML pages. ( scriptlet Tag)
It stands for Java Server Pages.
It is a server side technology.
It is used for creating web application.
It is used to create dynamic web content.
It is an advanced version of Servlet Technology.
It is a Web based technology helps us to create dynamic and platform independent web
pages.
In this, Java code can be inserted in HTML/ XML pages or both.
JSP is first converted into servlet by JSP container before processing the client’s request.
They are easy to maintain.
No recompilation or redeployment is required.
JSP has access to entire API of JAVA .
JSP are extended version of Servlet.

PHP is a widely-used, open source scripting language


PHP scripts are executed on the server

PHP can generate dynamic page content


PHP can create, open, read, write, delete, and close files on the server
PHP can collect form data
PHP can send and receive cookies
PHP can add, delete, modify data in your database
PHP can be used to control user-access
PHP can encrypt data

AngularJS is an open-source web application framework.


AngularJS is a structural framework for dynamic web applications.

AngularJS Directives
The AngularJS framework can be divided into three major parts −

The ng-app directive defines an AngularJS application.


The ng-model directive binds the value of HTML controls (input, select,
textarea) to application data.

The ng-bind directive binds application data to the HTML view.

<div ng-app="">
<p>Name: <input type="text" ng-model="name"></p>
<p ng-bind="name"></p>
</div>

AngularJS expressions are written inside double braces: {{ expression }}.

var app = angular.module('myApp', []);


app.controller('myCtrl', function($scope) {
$scope.firstName= "John";
$scope.lastName= "Doe";
});

An AngularJS module defines an application.

The module is a container for the different parts of an application.

The module is a container for the application controllers.

Controllers always belong to a module.

AngularJS controllers control the data of AngularJS applications.

Bootstrap is a free front-end framework for faster and easier web development
Bootstrap includes HTML and CSS based design templates for typography, forms, buttons,
tables, navigation, modals, image carousels and many other, as well as optional JavaScript
plugins
Bootstrap also gives you the ability to easily create responsive designs

WordPress is a Content Management System (CMS), which is open source and was created
to manage blogs. WordPress allows you to easily create and manage your blogs and
websites content without coding and it can be used to create a fully operational website.

A content management system, often abbreviated as CMS, is software that helps users
create, manage, and modify content on a website without the need for specialized technical
knowledge.
A CDN (Content Delivery Network) is a highly-distributed platform of servers that helps
minimize delays in loading web page content by reducing the physical distance between the
server and the user. This helps users around the world view the same high-quality content
without slow loading times.

Questions -

canvas tag
The <canvas> tag in HTML is used to draw graphics on a web page using
JavaScript. It can be used to draw paths, boxes, texts, gradients, and adding
images. By default, it does not contain borders and text.
<canvas id = "geeks" height = "200" width = "200"
style = "border:1px solid black">
</canvas>

sections tags
Section tag defines the section of documents such as chapters, headers, footers or
any other sections. The section tag divides the content into section and
subsections. The section tag is used when requirements of two headers or footers
or any other section of documents needed.

<section>
<h2>WWF's Symbol</h2>
</section>

which cdn is used in jquery,bootstrap - cdnjs

executequery and updatequery


executequery
executeQuery() was designed to execute query statements so it returns a ResultSet that
contains the data returned by the query.
executeQuery() method execute statements that returns a result set by fetching some data
from the database
String sql = "select * from user;";
PreparedStatement pst = conn.prepareStatement(sql);
ResultSet rs = pst.executeQuery();

executeUpdate
Instead of returning a collection of rows, the executeUpdate() method returns the number of
rows affected by the SQL command it executes.
executeUpdate() method returns the number of rows affected by the SQL command it
executes.
String query = "delete from user where firstname=?";
PreparedStatement pst1 = conn.prepareStatement(query);
pst1.setString(1,fname);
int ii = pst1.executeUpdate();

Iframe tag
The <iframe> tag specifies an inline frame.

An inline frame is used to embed another document within the current HTML
document.<iframe src="https://www.w3schools.com" title="W3Schools
Free Online Web Tutorials"></iframe>

Frameset Tag

A collection of frames in the browser window is known as a


frameset.

include directive vs include action


Include directive includes the file at translation time (the phase of JSP life
cycle where the JSP gets converted into the equivalent servlet) whereas the
include action includes the file at runtime.

<jsp:include>
Eg
<title>JSP include Directive example</title>
<%@ include file="display.jsp" %>

<title>JSP include Action example</title>


<jsp:include page="display.jsp" />

tags for table in html


<table> Defines a table
<th> Defines a header cell in a table
<tr> Defines a row in a table
<td> Defines a cell in a table

steps for php to mysql connectivity


$servername="localhost:3306";
$username="root";
$password="system";
$dbname="collegewt";
$con = mysqli_connect($servername,$username,$password,$dbname);

if(mysqli_connect_errno())
{
echo "Connection Error <br>";
}
else
{
echo "<br>Connection establish <br>";
}

$sqlinsert="insert into user


values('$fname','$lname','$phone','$email','$password','$confirm');";
if($con->query($sqlinsert)==TRUE)
{
echo "<br>Record inserted successfully...<br>";
}
else
echo "Record insertion failed<br>.$con->error";

$sqlselect="select firstname,lastname,phone,email from user;";


$result = $con->query($sqlselect);
if($result->num_rows>0)
{
while($row = $result->fetch_assoc())
{
echo "First Name : " . $row["firstname"]. " Last Name: " .
$row["lastname"]. " Phone : " . $row["phone"]. " Email: " .
$row["email"]. "<br>";
}
}
else
echo "0 results";

doget() vs dopost()
->doGet() shall be used when small amount of data and insensitive data like a query
has to be sent as a request. ->doPost() shall be used when comparatively large
amount of sensitive data has to be sent.

if ($_SERVER['REQUEST_METHOD'] == 'GET') {
doGet();
} else {
doPost();
}

alt in <image>
The required alt attribute specifies an alternate text for an image, if the
image cannot be displayed.

The alt attribute provides alternative information for an image if a user for
some reason cannot view it (because of slow connection, an error in the src
attribute, or if the user uses a screen reader).

javascript vs jquery
JQuery has an inbuilt feature of cross-browser compatibility.
JQuery is concise and one need not write much as scripting already exists.
In JQuery, we can add animation effects easily with fewer lines of code.
While JQuery is a library, derived from JavaScript hence, it is lightweight.

Hypertext and markup meaning

Hypertext" refers to the hyperlinks that an HTML page may contain.


"Markup language" refers to the way tags are used to define the page
layout and elements within the page.

tag to write CSS


<style> in CSS
CSS can be added to HTML documents in 3 ways:

● Inline - by using the style attribute inside HTML elements


● Internal - by using a <style> element in the <head> section
● External - by using a <link> element to link to an external CSS file

what is <head> in html


The head of an HTML document is the part that is not displayed in the web browser
when the page is loaded. It contains information such as the page <title>, links to
CSS (if you choose to style your HTML content with CSS), links to custom favicons,
and other metadata (data about the HTML, such as the author, and important
keywords that describe the document.)

Class in CSS

The .class selector selects elements with a specific class attribute.To select
elements with a specific class, write a period (.) character, followed by the
name of the class.

Servlet Life Cycle


Span tag

A <span> element which is used to color a part of a text:

<p>My mother has <span style="color:blue">blue</span> eyes.</p>

req and response

effects in jquerry
With jQuery, you can create custom animations.
The jQuery animate() method is used to create custom animations.

diff between cellspacing,cell padding


Cellpadding specifies the space between the border of a table cell and its
contents (i.e) it defines the whitespace between the cell edge and the content
of the cell
Cellspacing specifies the space between cells (i.e) it defines the whitespace
between the edges of the adjacent cells.
how to insert in table in php

What is a CDN in jQuery?


jQuery CDN is a method to include jQuery into a website without actually
downloading and keeping it in website's folder. There is many jQuery CDNs,
examples – Google, Microsoft, Belgua CDN, jQuery own CDN etc.

write how to connect jsp to mysql

<sql:setDataSource var = ""


driver = ""
url = ""
user = ""
password = ""/>

copy the code into your your JSP directory under /usr/local/etc/httpd/htdocs/html/LOGIN
(where LOGIN is your login name). You will need to change the 'xxxxxx' of
"con=DriverManager.getConnection("jdbc:mysql://localhost/"+db,user,"xxxxxxx");" to reflect
your MySQL password. Copy the HTML form (right click and view source) to the same
directory above or to your public_html directory and use it connect to your database via the
JSP code. Replace the 'test418' with your database name and the URL with your JSP URL.

<%@ page import="java.sql.*"%>


<html>
<head>
<title>JDBC Connection example</title>
</head>

<body>
<h1>JDBC Connection example</h1>

<%
String db = request.getParameter("db");
String user = db; // assumes database name is the same as username
try {
java.sql.Connection con;
Class.forName("org.gjt.mm.mysql.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/"+db, user, "xxxxxxx");
out.println (db+ "database successfully opened.");
}
catch(SQLException e) {
out.println("SQLException caught: " +e.getMessage());
}
%>

</body>
</html>

Servlet and MySQL connection code


String url = "jdbc:mysql://localhost:3306/collegewt";
String username = "root";
String pass = "system";

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url,username,pass);
out.println("\nConnection Successful!!..");
Statement st = con.createStatement();

What are Superglobal variables in PHP?

Superglobal Variables in PHP are predefined global variables. Global variables


are variables with global scope, which means that they can be used wherever
needed – they do not need to be declared, nor do they need to be marked with
global in functions. All superglobal variables are written in all-caps like,
$_GLOBALS .

● $_POST
● $_GET

tag create list


lit-html creates HTML <template> elements from the tagged template literals, and then clones
them to create new DOM.

Httpservlet vs genericservlet

-> GenericServlet is a super class of HttpServlet class. -> The main difference is
that, HttpServlet is a protocol dependent whereas GenericServlet is protocol
independent. So GenericServlet can handle all types of protocols, but HttpServlet
handle only HTTP specific protocols.
Global variables refer to any variable that is defined outside of the function. Global
variables can be accessed from any part of the script i.e. inside and outside of the
function.

Associative arrays are arrays that use named keys that you assign to them.

There are two ways to create an associative array:

$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

or:

$age['Peter'] = "35";

$age['Ben'] = "37";

$age['Joe'] = "43";

what is marquee tag


The HTML <marquee> tag is used for scrolling piece of text or image
displayed either horizontally across or vertically down your web site page
depending on the settings.
<marquee>This is basic example of marquee</marquee>
<marquee direction = "up">The direction of text will be
from bottom to top.</marquee>
how to validate email in js
function validateEmail(email) { const re =
/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([
a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(String(email).toLowerCase()); }

id selector class selector


Id is unique for tag
Class is common for multiple tags

JSP directives n examples


Syntax of Directive:

<%@ directive attribute="" %>

There are three types of directives:

1. Page directive
2. Include directive
3. Taglib directive

Use of ResultSet class in jsp

ResultSet rs = stmt.executeQuery(query);

A ResultSet object is a table of data representing a database result set, which is usually generated by
executing a statement that queries the database. For example, the CoffeeTables.viewTable method
creates a ResultSet, rs, when it executes the query through the Statement object, stmt. Note that a
ResultSet object can be created through any object that implements the Statement interface, including
PreparedStatement, CallableStatement, and RowSet.

eg of superglobal variables in php


There are so many predefined global variable in php. It can be accessible from any function,
class or file without you having to create them first. Global variable were introduced from php4.1
which is always available in all scope.

Super Global variables are an array variable in PHP

List of PHP superglobal variables are given below:

● $_GLOBALS
● $_SERVER
● $_REQUEST
● $_POST
● $_GET
● $_FILES
● $_ENV
● $_COOKIE
● $_SESSION

init method
The ng-init directive is used to initialize an AngularJS Application data. It
defines the initial value for an AngularJS application and assigns values to the
variables.
The ng-init directive defines initial values and variables for an AngularJS
application.

The Document Object Model (DOM) is a programming interface for HTML and XML
documents. It represents the page so that programs can change the document
structure, style, and content. The DOM represents the document as nodes and
objects. That way, programming languages can connect to the page.

defination list

The <dl> tag defines a description list.

The <dl> tag is used in conjunction with <dt> (defines terms/names) and
<dd> (describes each term/name).

Functions used in jquery

Use of ready function


The ready() method is used to make a function available after the document is
loaded. Whatever code you write inside the $(document ).ready() method will run
once the page DOM is ready to execute JavaScript code.

How to validate email in jquery


jQuery.validator.addMethod(
"noSpace",
function (value, element) {
return value == "" || value.trim().length != 0;
},
"No space please and don't leave it empty"
);
jQuery.validator.addMethod(
"customEmail",
function (value, element) {
return (
this.optional(element) ||
/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(
value
)
);
},
"Please enter valid email address!"
);
$.validator.addMethod(
"alphanumeric",
function (value, element) {
return this.optional(element) || /^\w+$/i.test(value);
},
"Letters, numbers, and underscores only please"
);

var $registrationForm = $("#coffee-form");


if ($registrationForm.length) {
$registrationForm.validate({
rules: {
//username is the name of the textbox
name: {
required: true,
//alphanumeric is the custom method, we defined in the above
alphanumeric: true,
},
email: {
required: true,
customEmail: true,
},
pswd: {
required: true,
},
pswd_repeat: {
required: true,
equalTo: "#password",
},
},
messages: {
name: {
//error message for the required field
required: "Please enter Name!",
},
email: {
required: "Please enter email!",
//error message for the email field
email: "Please enter valid email!",
},
pswd: {
required: "Please enter password!",
},
pswd_repeat: {
required: "Please enter confirm password!",
equalTo: "Please enter same password!",
},
address: {
required: "Please enter address!",
},
},
errorPlacement: function (error) {
error.insertAfter($("#error_msg"));
},
});
}

Start string and end string for regular expression


Start - /^
End - $/

Css selectors
In CSS, selectors are patterns used to select the element(s) you want to
style.

How to give background to html page


Bg = “”

Html vs html5

HTML is referred to as the primary language of the World Wide Web. HTML has
many updates over time, and the latest HTML version is HTML5. There are some
differences between the two versions:

● HTML5 supports both audio and video while none of them were part of

● HTML cannot allow JavaScript to run within the web browser, while HTML5
provides full support for running JavaScript.

● In HTML5, inline mathML and SVG can be used in a text, while in HTML it is
not possible.
● HTML5 supports new types of form controls, such as date and time, email,
number, category, title, Url, search, etc.

● Many elements have been introduced in HTML5. Some of the most important
are time, audio, description, embed, fig, shape, footer, article, canvas, navy,
output, section, source, track, video, etc.

Jsp directives with use

toggle method in jquery

$("p").toggle(
function(){$("p").css({"color": "red"});},
function(){$("p").css({"color": "blue"});},
function(){$("p").css({"color": "green"});
});

The toggle() method attaches two or more functions to toggle between for
the click event for the selected elements.

When clicking on an element, the first specified function fires, when clicking
again, the second function fires, and so on.

how to create hyperlink in html


<a href="https://www.w3schools.com">Visit W3Schools.com!</a>

input type in html

● <input type="button" required=”true”>

how to write input type text with mandatory filed

The required attribute is a boolean attribute.

When present, it specifies that an input field must be filled out before
submitting the form.

what is dom
When a web page is loaded, the browser creates a Document Object Model of
the page.

The HTML DOM model is constructed as a tree of Objects

diff xml html


XML: XML (eXtensible Markup Language) is also used to create web pages
and web applications. It is dynamic because it is used to transport the data not
for displaying the data. The design goals of XML focus on simplicity,
generality, and usability across the Internet. It is a textual data format with
strong support via Unicode for different human languages. Although the
design of XML focuses on documents, the language is widely used for the
representation of arbitrary data structures such as those used in web services.

commnet in html
<!-- -->

what is NaN function in js


The isNaN() function determines whether a value is an illegal number
(Not-a-Number).

This function returns true if the value equates to NaN. Otherwise it returns
false.

can we write server side js or not


Yes,Using node.js

undefnied vs Null
null is a special value meaning "no value". null is a special object because typeof null
returns 'object'.
On the other hand, undefined means that the variable has not been declared, or has not
been given a value.

how to create confirm pop box


window.confirm("sometext");
Yes, or choice

pattern attribute
<input type="text" id="country_code" name="country_code"
pattern="[A-Za-z]{3}" title="Three letter country code"><br><br>
What is json

JSON stands for JavaScript Object Notation

JSON is a lightweight format for storing and transporting data

JSON is often used when data is sent from a server to a web page

{"firstName":"John", "lastName":"Doe"}

Elements in json

JSON defines seven value types: string, number, object, array, true, false, and null.

The following example shows JSON data for a sample object that contains name-value pairs.

How the data is stored in json

Data is stored in a set of key-value pairs.This data is human readable, which makes JSON perfect for
manual editing

How we create and add elements in jQuery

We will look at four jQuery methods that are used to add new content:

● append() - Inserts content at the end of the selected elements


● prepend() - Inserts content at the beginning of the selected elements
● after() - Inserts content after the selected elements
● before() - Inserts content before the selected elements

Servlet and applet difference


A servlet is a Java programming language class used to extend the
capabilities of a server.
Servlets are executed on server side
Servlets are the Java counterpart to other dynamic Web content technologies
such as PHP and ASP.NET.
Servlets are under the server security.

A Java applet is a small application which is written in Java and delivered to


users in the form of bytecode.
Applets are executed on client side.
Applets are used to provide interactive features to web applications that
cannot be provided by HTML alone like capture mouse input etc.
Life cycle of Applets init(), stop(), paint(), start(), destroy().

Forname method in jdbc


The most common approach to register a driver is to use Java's Class.forName()
method, to dynamically load the driver's class file into memory, which automatically
registers it. This method is preferable because it allows you to make the driver
registration configurable and portable.

The second approach you can use to register a driver, is to use the static
DriverManager.registerDriver() method.

How to create and append element in jQuery


div = $("<div>").html("Loading......"); $("body").prepend(div);

Xml and xslt difference

1 XML is used for storing data in a XSLT is used for transforming and also
structured format. for formatting XML file to display the
content or to process the content.
2 XML does not perform XSLT is a specialized language that
transformation of data. performs transformation of one XML
document into a different XML document.
XSLT can also perform transformation of
XML document into HTML document and
XHTML document.
3 XPath is a specialized language that XSLT will be using XPath for
is used to address portions of the transformation and formatting of XML file.
XML file.
"Cascading" in this context means that because more than one stylesheet declaration
could apply to a particular piece of HTML, there has to be a known way of determining
which specific stylesheet rule applies to which piece of HTML.
The rule used is chosen by cascading down from the more general declarations to the
specific rule required. The most specific declaration is chosen.

● TML Color Coding Methods


○ Color Names
○ Hex Codes
○ RGB Value

JavaScript is a text-based programming language used both on the client-side and


server-side that allows you to make web pages interactive. ... Incorporating
JavaScript improves the user experience of the web page by converting it from a
static page into an interactive one. To recap, JavaScript adds behavior to web
pages.

Before the Flexbox Layout module, there were four layout modes:

● Block, for sections in a webpage


● Inline, for text
● Table, for two-dimensional table data
● Positioned, for explicit position of an element

The Flexible Box Layout Module, makes it easier to design flexible responsive
layout structure without using float or positioning.

You might also like