Q-3 Create university mark sheet with proper
format. (You can generate the copy of your own mark sheet. Display the content
properly by use of <table> and other useful tags).
Q-5 Write
a program in JavaScript that shows how the variable’s type can be changed on the
runtime.
Description:-You can use the var keyword in JavaScript to define a
variable in HTML. In JavaScript the data types of the variable is loosely typed
so we can change the data type of the variable at any time. A same variable can
have different values at different times of different data types.
Syntax:- var
<variable name>=value;
<!--
Q-1 Write a program in JavaScript that shows how the variable’s type can be changed on the runtime.
-->
<html>
<head>
<title>
Session 3- 1st program.
</title>
<script type="text/javascript">
var m=45;
document.write(m+" is "+ typeof(m)+" type<br>");
var m=45.2
document.write(m+" is "+ typeof(m)+" type<br>");
var m='S'
document.write(m+" is "+ typeof(m)+" type<br>");
var m="Sahin"
document.write(m+" is "+ typeof(m)+" type<br>");
</script>
</head>
<body>
</boby>
</html>
Q-6 JavaScript program that demonstrates the use of +=,-=,*=,/= Operators.
Example:-
var
a=10; // Initial value of the variable is a=10.
a+=10; // It increments the value of variable a=a+10
so the value a become 20.
a-=10;
// It increments the value of variable a=a-10 so the value a become 10.
a*=10;
// It increments the value of variable a=a*10 so the value a become 100.
a/=10;
// It increments the value of variable a=a/10 so the value a become 10.
<!--
Q-2 JavaScript program that demonstrates the use of +=,-=,*=,/= Operators.
-->
<html>
<head>
<title>
Session 3- 2nd program.
</title>
<script type="text/javascript">
var num1=parseInt(prompt("Enter First Number"));
var num2=parseInt(prompt("Enter Second Number"));
document.write("<br>First Number is : "+num1);
document.write("<br>Second Number is : "+num2);
document.write("<br>Adddition is : "+(num1+num2));
document.write("<br>Subtraction is : "+(num1-num2));
document.write("<br>Multiplication is : "+(num1*num2));
if(num2>0)
{
document.write("<br>Division is : "+(num1/num2));
}
else
{
document.write("<br>Division is not possible");
}
</script>
</head>
<body>
</boby>
</html>
Q-7 Create a
Form in HTML with two fields, minimum and maximum, write JavaScript to validate
that only numeric value is entered in both, and the value entered in minimum is
less than the value entered in maximum.
Description:- Take two
textboxes to accept two values from the user and check whether the values
entered in both the textboxes are numeric or not and put validation on it that
you can enter only numeric values. You can also
check the that the field marked as maximum should have greater value as
compared to the field marked as minimum if it is not so than put proper
validation for it.
Hint:
Key allowed in the textbox is 0-9, ‘.’.
<!--
Q-3 Create a Form in HTML with two fields, minimum and maximum, write JavaScript to validate that only numeric
value is entered in both, and the value entered in minimum is less than the value entered in maximum
-->
<html>
<head>
<title>
Session 3 - 3rd Program
</title>
<script type="text/javascript">
function validate()
{
var min=myForm.txt_min.value;
var max=myForm.txt_max.value;
if(parseInt(min)==min && parseInt(max)==max)
{
if(parseInt(max)<parseInt(min))
{
alert("Sorry! Value of MAX must Be Greater");
}
else
{
alert(" Validated ");
}
}
else
{
alert("Both Must b Numeric Value");
}
}
</script>
</head>
<body>
<form name="myForm">
<table border="1" align="center" width="40%">
Q-9 Write a Servlet which will display all the parameters which are passed to the servlet page.
Hint:The previous page which will send the parameter should implement the method GET and the page should contain one textbox and a button. When the button is clicked the servlet page should get opened and should read the value of the textbox passed as an parameter.
Step 1 : Create Simple HTML Page With Form Elements.
Q-10 Change the above program definition implement more than one textbox and other element on the page pass them as a parameter and handle Step 1 : Create HTML Page With All Form Elements Such As TextBox,TextArea,Radio,CheckBox,List With MultipleSelection.
Q-11 Write a Servlet to display all the headers available from request.
Hint: display all the header content using all the header function available in the request header.
Display value for all the function: •getAuthType •getRemoteUser •getContentLength •getContentType •getHeaderNames •getMethod •getRequestURI •getQueryString •getProtocol
Step 1: Create HeaderInfo.Java using Packages Concepts for servlet which can handle all header functions.
Q-12 Write a Servlet to display all the attributes available from headers (request and context). Hint: Make use of getHeader() to get all the related and display all the attributes available in the getHeader() function. All the attribute: •Accept •Accept-Charset •Accept-Encoding •Accept-Language •Authorization •Connection •Content-Length •Host •Referer •User-Agent
Step 1: Create GetHeader.Java using Packages Concepts for servlet which can handle all header Attributes.
Q-13 Write a Servlet which displays a message and also displays how many times the message has been displayed (how many times the page has been visited). Hint: Create a file which will update the counter each and every time the page is being loaded.
(Using Database Connection)
Step 1: Create a database with name database.mdb , Table name dbCounter , Column name counter with type numeric and add dsn with name db_count.
Step 2: Create VisitCounter.java servlet file which can interact with database for fetching and update counter value.
Q-14 Assume that we have got three pdf files for the MCA-1 Syllabus, MCA-2 Syllabus and MCA-3 Syllabus respectively, Now write a Servlet which displays the appropriate PDF file to the client, by looking at a request parameter for the year (1, 2 or 3).
Hint: Create a HTML pages which will have a textbox and
button. The user will enter the values in the textbox –
either 1,2,3. Pass the value to a servlet page which will
read the parameter value and display the appropriate
PDF file. If the option is invalid they just display the
message invalid semester.
Note: You can use any method – GET or POST
Step 1: Create HTML Page which will have a textbox and button.
which can pass value to servlet page.
No comments:
Post a Comment