JSP Practical Exercise

  • Write a JSP code to print 1 to 10 on screen.
  • Write a JSP code that prints following on screen.
    • 1 1 1
    • 1 1 1
    • 1 1 1
    • ————————-
    • 1
    • 1 1
    • 1 1 1
    • ——————————-
    • 1 2 3
    • 1 2
    • 1
  • Write a JSP code to design a web page that accepts a user name and greet user hello <unm>.
  • Write a JSP code to design a web page which accepts user name and password and compare it against static username and password, display appropriate message valid/ invalid user.
  • Write a JSP code to design a web page which accepts user name and age from user if age is less than 30 change background color to red else green
    .

JavaScript Exercise

prompt user for the name and display it.

prompt user for the number and check whether it is palindrome or not.

prompt user for the number and find factorial of it

display pattern like this
*
**
***

Write a JavaScript that shows how a variable’s type can be changed on-the-fly.

Write a JavaScript that demonstrates the use of +=,-=,*=,/= operators.

Write a JavaScript program to convert degrees centigrade into degrees Fahrenheit, and write the result to the page in a descriptive sentence. The JavaScript equation for Fahrenheit to centigrade is
degFahren = 9 / 5 * degCent + 32

Define a function max() that takes two numbers as arguments and returns the largest of them. Use the if-then-else construct available in Javascript.

Define a function maxOfThree() that takes three numbers as arguments and returns the largest of them.

Write a function that takes a character (i.e. a string of length 1) and returns true if it is a vowel, false otherwise.

Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in an array of numbers. For example, sum([1,2,3,4]) should return 10, and multiply([1,2,3,4]) should return 24.

Define a function reverse() that computes the reversal of a string.

Write a function to sort a list of words (an array) in alphabetical order

Write a function findLongestWord() that takes an array of words and returns the length of the longest one.

Write a function filterLongWords() that takes an array of words and an integer i and returns the array of words that are longer than i.

Write a function charFreq() that takes a string and builds a frequency listing of the characters contained in it.

Display a greeting based on the time of day. For example; Good Morning if it is in the morning or Good Afternoon if it is the afternoon.

Display today’s date on the page in the following format: November 25, 2010.

Write a JavaScript that finds out multiples of 10 in 0 to 10000. On the click of button start the timer and stop the counter after 10 seconds. Display on the screen how many multiples of 10 are found out within stipulated time.

Write a JavaScript to generate two random numbers and find out maximum and minimum out of it.

Write a JavaScript to remove the highest element from the array and arrange the array in ascending order.

Write a JavaScript to find a string from the given text. If the match is found then replace it with another string.