UNIT-II
Java GUI Programming Revision Tour – I
S. No.
|
Concept
|
Degree of Importance
|
Level
|
Errors generally committed
|
References
|
1
|
Netbeans Java IDE
|
**
|
L1,L-2
|
Not use appropriate component
| |
2
|
Basics of GUI
|
*
|
L1
|
Wrong properties used
| |
3
|
Tokens
|
*
|
L1
|
Wrong identification
| |
4
|
Data Types
|
***
|
L1,L2
|
Appropriate data types not used
| |
5
|
Variables
|
*****
|
L2, L3
|
Wrong Declarations
| |
6
|
Text Interactions
|
****
|
L1, L2
|
Proper syntax errors
| |
7
|
Operators in Java
|
*****
|
L1, L2
|
Wrong evaluation
| |
8
|
Expressions
|
****
|
L1, L2,L3
|
Semicolon not used
| |
9
|
Programming Constructs
|
*****
|
L2, L3
|
Level - 1
Ans1. Rapid Application Development describes a method of developing software through the use of pre-programmed tolls or wizards.
Ans2. Events are activities that take place either due to user interaction or due to some internal changes e.g. user clicks upon a command button or text of a textbox changes owing to a calculation.
Ans3. A message is the information/request sent to an application about the occurrence of an event
Ans4. Properties are characteristics of an object that control its appearance and /or behavior.
Ans5. Identifier are fundamental building blocks of a program and are used as the general terminology for the names given to different parts of the program e.g. variables, objects, classes, functions etc.
Ans6. Keywords are the reserved word in java and having a special purpose and they cannot be used for any other purpose.
Ans7. GUI stands for Graphical User Interface. This programming style involves graphics entities, rather than writing numerous lines of code.
Ans8. Execution of multiple cases after matching takes place in a switch statement.
Ans9. Unicode
Ans10. Class new else try
Level – 2
Ans1. Statement that unconditionally transfer program control with in a function.
Ans2. int i= 0;
for(i=51; i<=60; i++)
{
System.out.print(i + “ “);
}
Ans3. In a switch statement, after matching case’s code is executed, it stop only when it encounters break or closing brace ( } ) of switch.
So, break statement acts as terminating statement for matched case in a switch statement.
Ans4. Operators are the symbol that defines what kind of operation is to be done. Operators required operands to perform operations.
1. Unary operators
2. Binary operators
3. Ternary operators
Ans5. 2
Ans.6. = represent an assignment operator. It sets the value of the variable on its left side with the result of expression on its right side. == represent a conditional equal to operator. It checks for the equality of both its operands. If both the operands are equal, condition evaluates to true otherwise to false.
Ans.7. Two selection statement available in java are ‘if’ and ‘Switch’
Ans8. Difference between while and do while loop
While
|
Do while
|
While
|
Do while is a exit control loop
|
int x= 100;
while (x> 0)
{
System.out.println(X);
X= x- 10;
}
|
int x= 100;
do
{
System.out.println(X);
X= x- 10;
}
while (x> 0);
|
Ans9. Converting a value form one type to another is called type casting.
For e.g. int a = 5 .here ‘a’ is a integer, which can be cased to float as follows
float b = (float) a;
Ans.10.Data types that are directly available with java are called primitive data type. Various primitive data types available in java are byte, short, int, long, float, double, char and Boolean.
Level -3
Ans1. Application Programming Interface.
Ans2. Although properties, methods and events do different things, yet they are interrelated. Properties can be thought of as an object’s attributes, methods as its actions, and events as its responses.
Ans3.This programming style responds to the user events and is driven by the occurrence of user-events.
Ans.4 (i) Sequence constructs
(ii) Selection statement
(iii) Iteration statement
Ans5. Every loop has its elements that controls govern its execution. Generally, a loop has four elements that have different purposes. These elements are as given below:
1. Initialization expression(s)
2. Test Expression.
3. Update Expression(s)
4. The body of the loop
Ans6. The switch statement must be controlled by single integer control variable, and each case section must correspond to a single constant value for the variable. The if else if combination allows any kind of condition after each if
Ans7. Difference between an entry control loop and an exit control loop.
Entry Control
|
Exit Control Lop
|
It first checks or evaluates the terminating condition and then executes the loop body.
|
It first evaluates the loop body and then checks the terminating condition. If the condition is found true the loop continues otherwise the loop stops.
|
In case if the condition is false in first time only then the loop will not get execute even once.
|
In case if the condition is false in first time only then the loop will still get execute at-least once.
|
Ans8. Infinite Loop , hence it is not possible to find the final value of i
Ans9. //Assumes that given number is available int variable n
int fact = 1;
for(int i=1; i<=n; i++)
{
Fact=fact*i;
}
Ans10. 69
Revision Tour - II
Level-1
Ans1. System.exit(0);
Ans2. OKBtn.doClick();
Ans3. For this we shall set the icon property to the path a specific image file and text property to specific text.
Ans4. A combobox is a graphical control that displays a list of values in a drop-down list form.
Ans5. (i) JList (ii) JComboBox
Ans6. CheckListValueChanged( )
Ans7. By setting editable property of combo box, we can make it editable.
Ans8. (c) a character array.
Ans9. RAD stands for Rapid Application Development. A programming style which aims at building programs fastly through the use of tools and wizards is called RAD.
Ans10. A text fiels’s text property can hold single line of text unless it is an HTML text.
A text area’s text can hold any number of lines of text depending upon its rows property.
Level-2
Ans1. A button group is a group of controls out of which only one can be selected at a time.
A button group is created through JButtonGroup component class of Java Swing.
In a button group we can put radio buttons or push buttons
Ans2. Java program can be easily moved from one computer system to another, anywhere anytime. Changes and upgrade in operating system, processors and system resources will not force any change in the Java program. Hence it is called a platform independent language.
Ans3. The source program is first converted into a byte code using a java compiler. This byte code is machine independent i.e. same for all the machines. Later the byte code is executed on the machine using an interpreter.
Ans4. Comments are added to a program for the following purposes:-
1. Make the more readable and understandable
2. For future references
We can add comments in a Java program in the following ways:
1. Adding // before the line which is to be commented. This can be used only for single line comments.
2. using a pair of /* and */ for multi-line comments.
Ans5. Error in the way of writing a statement in a program, results in a syntax error.
For e.g.
for ( i=0, i<=100. i++), will result in a syntax because the program has written comma instead of a semi comma in the for loop.
Ans6. Yes, it is possible to store a text in a jTextField in a Integer variable. To store the text, first it must be converted into intertype using the pareInt() method.
int stud_cnt= Integer.pareInt(JTextFiled1.getText());
In the a above statement, first the getText() function obtains the text written in the jTextField1 and then convert it into integer type using parseInt() method of available in Integer class.
Ans7. A programming environment, where all the tools required for programming are available under one roof is called IDE. Two IDE for Java are Netbeans and BlueJ
Ans8. Keyword, Identifier, Literal, Punctuators ad Operators
Ans9. A Switch statement is used execute a statement from a group of statement based on the result of a expression. The expression must result in either of byte, short, integer or character.
An ‘if statement’ can be used in place of switch statement
In a switch statement if none of the statement satisfies and even there is no default case then nothing would happen. This would not result in any sort of error.
Ans10. Break is used to terminate the current switch statement or the loop.
Level-3
Ans1. A list is a graphical control that display a list of items in a box where from the user can make selection.
A list is different from combobox in many ways:
(i) A list does not have a text field the user can use to edit the selected item, whereas a combobox is a cross between a text field and a list.
(ii) In a list user must select the items directly from the list whereas in a combobox user can edit it if he/ she wishes.
(iii) The list does not drop down whereas a combobox takes less space initially but drop down when user clicks obn its arrow.
(iv) List allow us to select more than obe items but combobox allows only single item selection.
Ans2. Through a text field and a password field can obtain a single line of text from user, yet there are difference
A password field displays the obtained text in encrypted form on screen while text field displays the obtained text in unencrypted form.
Ans3. Top level containers: JFrame, JDialog
Middle level containers: JPanel, JTabbedPane
Component level containers: JButton, JLabel
Ans4. A container is a control that can hold other controls within it e.g. a Panel, a Label, Frame etc.
Controls inside a container are known as child controls. The child controls can exit completely inside their containers.
When we delete a container control, all its child controls automatically get deleted.
Ans5. An Event refers to the occurrence of an activity.
Events can occure through user actions such as a mouse click or key press.
Each time an event occurs, it causes a message to be sent to the operating system.
Ans6. A GUI (Graphical User Interface) is an interface that use pictures and other graphic entities along with text , to interact with user.
You can create a GUI application on Java platform using Swing API(Application Programming Interface), which is part of Java Foundation Classes (JFC).
Ans7. private void jBtnClearActionPerformed(java.awt.event.ActionEvent evt)
{
jTextField1.setText(“ “) OR jTextField1.setText(null)
jTextField1.setText(“ “) OR jTextField1.setText(null)
jTextField1.setText(“ “) OR jTextField1.setText(null)
jTextField1.setText(“ “) OR jTextField1.setText(null)
jCheckbox1.setSelected(false);
}
private void jBtnCalcPerActionPerformed(java.awt.event.ActionEvent evt)
{
int p;
p=Integer.parseInt(jTextField2.getText());
if (jCheckBox1.isSelected())
p=p+5;
jTextField3.setText(Integer.toString(p));
}
private void jBtnResultActionPerformed(java.awt.event.ActionEvent evt)
{
int p;
p=Integer.parseInt(jTextField3.getText());
if( jRadioButton1.isSelected())
{
if ( p>=70)
jTextField4.setText(“Eligible for all subject”);
else
jTextfield4.setText(“Not Eligible for science”);
}
else if( jRadioButton2.isSelected())
{
if ( p>=60 )
jTextField4.setText(“Eligible for Commerce and Humanities”);
else
jTextfield4.setText(“Not Eligible for Science and Commerce”);
}
else
{
if ( p>=40 )
jTextField4.setText(“Eligible for Humanities”);
else
jTextfield4.setText(“Not Eligible for any subject ”);
}
}
private void jBtnCloseActionPerformed(java.awt.event.ActionEvent evt)
{
System.exit(0);
}
Ans8. Joption pane support the following Dialog types:
a) Input Dialog: provides a text Field, Combo box or a list box for the user to input an option or value.
b) Confirm Dialog: it helps the user to input the choice in the form of Ok, Cancel, Yes, No etc.
c) Message Dialog: It is a simple dialog box to display a message with a OK button.
Option Dialog: helps to create a dialog box according to the requirements of the user.
Ans9. showInputDialog(): to display an Input dialog Box:
· showIConfirmDialog(): to display a confirm dialog Box:
· showMessageDialog(): to show a Message dialog Box:
· showOptionDialog(): to show a option dialog Box:
Ans10. Various possible values for Option type property of jOptionPane are
-1: used to display a simple OK Button.
0: To display both Yes and No button
1: To display Yes, No and Cancel button,
2: To display Ok and Cancel button.
UNIT-II
Chapter- 5 JAVAGUI PROGRAMMING REVISION TOUR-III
Level –I
1 Class
2 Yes
3 Non-Parameterized Constructor
4 Which can receive Parameters.
Level- II
1 Whenever object is created.
2 when object is created and by using (.) Operator.
3 In Call by Value , The called method creates it’s own work copy for the passed parameters and copies the passes values in it. Any changes that take place are done in the work copy and the original data remain intact.
In Call by reference, the called method receive the reference to the passed parameters and through this reference, it access the original data. Any changes that take place are reflected in the original data.
Level- III
1 Constructor Properties are: (i) have no return type, not even void (ii) constructor should be defined as public, so that it’s objects can be created in any method.
2 The data type that are based on fundamental or primitive data type, are known as Composite data type. User Defied Data type are created by users.
3 Software objects have state and behaviour like their state is maintained through variables or data items. Their behaviour is implemented through functions generally called methods.
Real World object also physical characteristics(or state) and behaviour e.g. a Motorbike has:
Like: Current gear,two wheels are Characteristics
Like: halting, accelerating are States
4 The keyword this refers to currently calling object. It is automatically created and initialized by java. So you can refer to current object by using keyword this.
Answer to the Chapter -6
More about Classes and libraries
Level 1
1
|
Length() return the length while capacity() return maximum no of character that can be entered.
|
2
|
Return length , extract substring , conacat string specified in argument, removes the leading & trailing spaces, convert into upper & lowercase
|
3
|
Java.applet , java.awt, java.io, java.net
|
4
|
Abstract classes are used for inheritance
|
5
|
Abstract classes are used for inheritance while interface is used for multiple inheritance
|
6
|
Compareto () compares 2 string while equals( ) check for equality
|
7
|
indexOf(char ch) returns the index of the Character Ch
|
8
|
Power(a,b ) finds the value of a raise to power b
|
9
|
Append() is used to append the string in a textarea to its p
|
10
|
charAt(int a) retruns the character present at position a in the string
|
Level 2
1. Related classes and interfaces grouped together is called as package.
2.
Member Type
|
Its Own class
|
Derived Class
| |
Same Package
|
Other Package
| ||
Public
|
Accessible
|
Accessible
|
Accessible
|
Protected
|
Accessible
|
Accessible
|
Accessible
|
Default
|
Accessible
|
Accessible
|
Not Accessible
|
Private Protected
|
Accessible
|
Accessible
|
Not Accessible
|
Private
|
Accessible
|
Not Accessible
|
Not Accessible
|
3. Final keyword is used fro a class to make it static
4 Whenever a class contains only general code and need to be inherited .
5. (a) s.length() will give output -17
(b) jTextField2.setText(s.toLowerCase()) will give output abc micro systems
6 (a) 2
(b) 8
7. (a) ABC Microsytems
(b) 3
( c) 12
8. HBC
9. ABC Microsystems
10. 2
Level 3
1. string str = Tf.getText();
int len = str.length();
char ch =character.toUppercase();
str = ch + str.substring(1);
for (int I =2 ;i<len -1; i++)
{
If (str.charAt(i) == ‘ ‘)
{
Ch = character.toupperCase(str.charAt(i+1));
Str = str.substring(0,i+1) + ch +str.substring(i+2);
}
}
TF.setText(str);
- string str = STF.getText();
char ch = charTF.getText().charAt(0);
int count = 0;
for(int i=0; i<str.length(); i++)
{
If(str.charAt(i) = = ch)
Count=count+1;
}
occurLable.setText(“”+ Count);
- string str = STF.getText();
string strRev = “”;
for(int i=str.length()-1 ;i>0 ; i--)
{
strRev=strRev+ str.charAt(i);
}
Revtf.setText(strRev);
4. i. abc ii. Abcxyz
- CentralMadras
- ABC Micto Systems
- i INFORMATICS PRACTICES ii Informatics Practices
- Informatics Practices Practicals
- 20
- SPACE In
Chapter -7
Lesson-Inheritance
Level 1
Ans-1 Inheritance: The ability of a class to obtain the characteristics of another class is called inheritance.
Need of Inheritance: Inheritance helps in two ways:
· Code Reusability:
· Helps in expressing relationship among classes
Ans -2 Type of Inheritance:
o Single Inheritance
o Multiple Inheritance
o Hierarchical Inheritance
o Multilevel Inheritance
o Hybrid Inheritance
Ans-3 Base Class (Parent Class): The Preexisting class which is being inherited is called the base class or the parent class. It is also called a Super Class
Derived Class (Child Class): The new class which inherits the capabilities from another pre-existing class is called the Derived Class or the Child Class. It is also called Sub Class.
Ans-4 Public, Protected Default, Private Protected, Private and their scopes
Ans -5 Function Overriding:
o If a derived class method has the same name as that of the base class then the derived class method overtakes (get higher preference) the base class method. This is known as overriding of base class method.
Function overloading:
o Two or more functions in the same scope having the same name but different signatures are said to be overloaded. For two functions to be overloaded either they should have different number of arguments or different order of arguments.
As-6 Abstract Class: A class that cannot be instantiated.
Abstract Method: A method without implementation.
As- 7 No
Level-2
Ans -1 Type of Inheritance:
o Single Inheritance: A single Base class is being inherited by a single derived class.
o Multiple Inheritance: A single derived class inherits more than one base class.(This type of inheritance is not supported in Java)
o Hierarchical Inheritance: A single base class is being inherited by more than one child classes.
o Multilevel Inheritance: A child class act as a base class for anther child class.
o Hybrid Inheritance: A combination of two or more of the above inheritance pattern.
Ans- 2 No
Ans- 3 Final class cannot be inherited. Final methods, classes are used for security. This is because Hackers extend some of important classes and substitute their classes for the origin.
As-4 Abstract Class: A class that cannot be instantiated.
public abstract class shape
{
-----
----- }
Ans-5 An interface cannot implement any methods.
No variables can be inherited from interfaces.
Level 3
Ans 1 Reusability
Base Class & Derived Class
Ans-2 A concrete/abstract superclass is the one whose objects cannot be declared and created. When
we need to define general characteristics and behavior of its subclass es.
Ans-3 a) An interface can be implemented by a class which is already a subclass of
another class. A class which is already a subclass of another class can’t extend an abstract class as well.
b) An abstract class can contain non abstract methods where as a interface can’t contain non-abstract methods. All methods of an interface must be abstract.
Ans-4 Protected member is accessible in non sub class of same package but friendly is not Accessible.
Ans-5 1. Create the class Student
2. Declare data members & functions
3. Create another class graduate and extend the Student class
Ans- 6 It is determined by the type of the object being referred to at the time of call.
Unit -2 ( Programming)
Chapter – 8 ( GUI Dialogs and Tables)
LEVEL 1
Ans 1: To provide or request information to / from the user.
Ans 2: Table
Ans 3: Yes
Ans 4: Yes with associated TABLE_MODEL
Ans 5: Allows displaying data in row column format.
Ans 6: dispose() method.
Ans 7: InputDialog
Confirm Dialog
Message Dialog
Option Dialog
LEVEL 2
Ans 1: A small separate window that appears to user.
Ans 2: OK and CANCEL.
Ans 3: Step 1: to get the table-model
DefaultTableModel <name>= (DefaultTableModel) <table-name>.getModel();
Step2: tocount the rows
Int r = <name>.getRowCount();
Step 3: to remove the indexed row.
<name>.removeRow(index);
Ans 4: import javax.swing.JOptionPane;
Ans 5: setVisible(true);
Ans 6: float n1,n2;
n1=23.45;
n2=45.67;
float ans=n1+n2;
JOptionPane(ans);
Ans 7: showMessageDialog
showConfirmDialog
showOptionDialog
showInputDialog
LEVEL 3
Ans 1: InputArea
Icon Type
Message
Button
Ans 2: it is associated object that provides source-data to a JTable Object. It is the table-model that organizes the source data in row-column format.
Ans 3: int val =0;
int sum=0;
do
{
val=JOptionPane.showInputDialog(“Enter any Number”);
sum=sum+val;
}while(val <> 0);
JOptionDialog.showMesageDialog(“The sum =” + sum);
Ans 4: This command specifies question mark icon to be displayed alongwith the JOptionPane through message type property.
Ans 5: The Message dialog (invoked with showMessageDialog()) does not return anything.
UNIT 9:DATABASE CONNECTIVITY TO MYSQL
Level 1:
Ans1:Database Connectivity refers to connection and communication between an application and a database system.
Ans2: JDBC: Java Database Connectivity is a framework developed by Sun Java to help Java connect to different databases
ODBC:Open Database Connectivity is a framework used by Microsoft to connect to various types of databases.
JDBC provides database connectivity from within Java application to databaseswhereas ODBCprovides databases connectivity to non-Java front end applications.
But ODBC is language independent as it can work with any language but JDBC is language dependent as it works only for Java.
Ans3:A resultset refers to a logical set of records that are fetched from the databases by executing a query and made available to the application program.
Ans4: getInt(),getFloat(),getString(),getDate().
Ans 5: next(), first(), last(), relative(int rows), absolute(intrno), getRow()
Level 2:
Ans1: Tasks:
a) Establish a connection with a database.
b) Sending SQL statements to database server
c) Processing the results obtained
Ans2: Connection: A connection is the session between the application program and the database.
Role:To do anything with database one must have a connection object.
Ans3:It is use to create an instance of a driver and register it with the DriverManager.
Ans4: Consider following line of code:
Connection con=DriverManager.getConnection
(“jdbc:mysql://localhost:3306/test”,”root”,”pwd”);
*pwd is the password assigned to your MySQl.
Ans5: Statement object execute one static SQL statement on the associated database by executing a query and made available to the application program.
Ans6:Class.forName(“com.mysql.jdbc.Driver”);
Level 3:
Ans1. a)Consider the Table DEPT(deptno,deptname,address).
b) Provide connectivity URL.
c)Use Java classes
d)Store the Select query in a string.
e) use method executeQuery()
Ans2. Ans1. a)Consider the Table DEPT(deptno,deptname,address).
b) Consider the buttons INSERT,DELETE,UPDATE and write the respective operations
separately.
b) Provide connectivity URL.
c) Use Java classes
d) Store the query in a string.
e) use method executeQuery() and executeUpdate()
Web Application Development
LEVEL-1
1. It is software programs that allow to user to access and navigate www. (Internet Explorer,Mozilla Firefox, Google Chrome)
2. It is a software program that allows to user to access and navigate WWW. (Internet Explorer,Mozilla Firefox, Google Chrome),Web Server is a program that runs on the computer connected to the Internet and fulfils the request send by the web browser.(Ex. Apache Web Server, Netscape Enterprise Navigator).
3. In Client/Server Computing: - Client makes a request for services from another program and Server fulfils the request send by the clients.
4. A location on Net Server is called web site.
5. (a) Hypertext transfer protocol
(b) World wide web
(c) Uniform resource locator
(d) Computer generated imagery
6. Server-site
7. CGI
8. File
9. The WWW
10. Host
LEVEL-II
1. Each website has a unique address called URL (uniform resource locator) its components are
(a) The type of server or protocol e.g http
(b) The name and address of the server. e.g MSN.com
(c) Location of the file on the server e.g. encycle.msn.com/get info/style.asp
2. CGI scripts and Server Side Scripts are used to create dynamic WebPages.
3. The other server on the Internet:-ftp, gopher, cater to textual information but www uses http server caters to multimedia information. So it enables user to receive hypertext information.
4. FTP. (1 Mark for Abbreviation and/or Full Form)
5. A URL (Uniform Resource Locator) is the complete address of a document on the web,
Whereas a domain name specifies the location of document's web server. A domain
Name is a component of the URL used to access web sites.
For example the web address
http://www.example.net/index.html is a URL.
LEVEL-III
1. Set of rules are called protocols. A file’s internet address or URL is determined by protocol.
2. Dynamic WebPages support client server concept i.e. any request are fulfilled by server while static WebPages does not support client sever concept.
3. The character based naming system by which servers are identified is known as domain name system.
4. HTTP
5. The above address is called IP address or Internet protocol address.
It is numerical label that is assigned to devices participating in a network.
Unit -2 ( Programming)
Chapter –11 SOLUTION ( HTML:-Basic HTML elements)
ANSWERS:
LEVEL 1:
- to create web pages.
- HEAD tag
- not case-sensitive
- .html (dot html)
- Body of html document is prepared in <BODY> tag
- <BODY BGCOLOR=VBRED>
LEVEL 2:
- By usig <body> tag and its background attribute
- Container tags have both starting and ending as well as empty tags have only starting tags.
- LEFT, RIGHT , CENTRE
- BGCOLOR, BACKGROUND
- <BODY> , BACKGROUND
- <P> tag is used for making paragraph and <BR> tag is used for break a line.
LEVEL 3:
- It lets you know the basic size for the font. Attributes- size, face
- It is basically used for a short segment of text.
- <HEAD> tag is used for giving title of the document and <BODY> tag is used for making body of the document.
- <!------>
- For giving different sizes of headings from h1 to h6
- <SUP> TAG
- Colspan is used for merging columns and rowspan is used for merging rows.
Chapter 12 : HTML-II (Lists ,Tables and Forms)
Level 1.
1 . The different forms of lists are: ordered and unordered lists. For example, UL and OL.
2. The <OL> tag is used to indicate a list item as contained in an ordered or numbered form. For example
i. <OL>
1. <LI> Apples
2. <LI> Oranges
ii. </OL>
iii. Two attributes are: START, TYPE.
3. CELLPADDING tells the browser how much padding is required in the cell. In other words between the side of the cell and the contents of the cell. Try a few different numbers. Note that cell and padding run together and are one word. To control the horizontal alignment of text and images within table cells use the align attribute i.e., align=left, align=right or align=center.
- CELLSPACING defines how much space you’d like in cells. It specifies the amount of space between the frame of the table and the cells in the table. Note that cell and spacing run together.
- In a list, the TYPE attribute specifies the type of numbering (:A”, etc.) or bulleting (“circle”, “Disc”, Square”, etc.) depending on whether the LI is inside an OL or UL list.
- The START attribute is used to change the beginning value of an ordered list. Normally, the ordered list starts with 1. for example, <OL START = 10>
- It is used to define a set of header rows.
- They are used to specify the span of a cell.
- Align attribute is used to control the horizontal alignment of the contents of a cell.
- They are indented lists with a specific bullet.
Level 2:
- Table is a collection of rows and column.
Followings are important tags
<Table> :- used to give identification to a table
<TH> :- To provide headings in a table
<TR>:- (Table Row) to create Row in a table
<TD> :- (Table Data) to create columns in a row
- To create or use forms in a web page <FORM> tag is used. Form is means to collect data from the site visitor. It is done with the help of controls that collect data and send it over.
Example:
<FORM method = “POST” action=mailto:xyz.abc@gmail.com>
- Text boxes are single line text input controls that are created using <INPUT> tag whose TYPE attribute has a value as “Text”.
Example:
<FORM method = “POST” action=mailto:xyz.abc@gmail.com>
First Name:
<INPUT TYPE=”text” NAME = “fname”/>
<BR>
Last Name:
<INPUT TYPE=”text” NAME = “lname” />
</FORM>
- <Input type =”radio” name=”stream” value= “science”/>
- <Input type=”checkbox” name=”s2” value=”physics”/>
- <text area=”5” cols=”50” name =”description”>
- They are indented lists without any billet symbol or any number in front of each item.
Level 3:
1. Sometimes a table cell is bigger than other. Its span is spread to more rows or columns. Such cells can be created with rowspan and colspan. For instance following code will produce the table shown below it in which cells have different span.
<html>
<body>
<table border>
<tr>
<td align=center rowspan =2 colspan=2>a</td>
<td>1</td>
<td>2</td>
</tr>
- An HTML Form does not do anything without a program to process the information .We need to specify the following things in order to get the form processed.
a) Where the processing program is located.
b) How it takes information i.e. whether we need to use the POST or GET method.
- When Submit button is clicked then the forms data is submitted to the back end application.
When Reset button is clicked then all the forms controls are reset to default size.
- GET sends the information to the URL specified through action attribute.
POST sends the form information in the HTTP environment.
- <html>
<body>
<p align=center>
<center><h1>example</h1></center>
</p>
<form method=post>
<p> persons name:
<input type="text" name="persons-name" size="40" maxlength="40">
<input type="hidden" name="recipient" size="40" maxlength="40">
</p>
<p> password:
<input type="password" name="password" size="10"maxlength="10">
</p>
<p>please place me on your mailing list
<input type="checkbox" name="mailing-list" value="yes" checked>
</p>
<p>what country do you live in?
<select name="country">
<option value="ind ">india
<option value="usa ">united states
<option value="ca">canada
<option value="fr">france
<option value="spr">singapore
</select>
</p>
<p>type of computer you have
<input type="radio" name="comp-type" value="486dx">486dx
<input type="radio" name="comp-type" value="486sx">486sx
<input type="radio" name="comp-type" value="pentium2" checked > pentium 2
<input type="radio" name="comp-type" value="pentium3">pentium3
<input type="radio" name="comp-type" value="pentium 4">pentium4
</p>
<p> comments
<input type="submit" name="request" value="submit this form">
<input type="reset" name="clear" value="clear form and start over">
</p>
</body>
</html>
No comments:
Post a Comment