CIS 757/790 JavaScript QUIZ

PASSING PARAMETERS FROM HTML TO A JAVA APPLET

Last.First Name:

CIS 757 QUIZ 05 JavaScript PROF. AUCIELLO

EXPLANATION:

          This lesson-quiz represents some 'break-through'  thinking:

          These quizzes demand interaction.  The plan is to create the 
          equivalent of a classroom discusson on the Web.  Added to 
          this is that you are graded for participating, and hopefully
          you will glean information from others that will add to your
          understanding and subsequently Mastery over the topics 
          discussed.  

At the end of the lesson, -- when you know that you understand it -- say "Mr. A. -- I got this lesson, thank you -- and type your name.

Here is the HTML source code for "Passing Parameter" <html> <head> <title> PASSING PARAMETERS </title> <h3> PASSING PARAMETERS FROM HTML TO A JAVA APPLET BY PROF. AUCIELLO </H3> <pre> Here is the HTML code for Param Passing. <xmp> <html> <h3> CIS 757 Passing Parameters </h3> <APPLET CODE ="param5" WIDTH=400 HEIGHT=150> <param name="param1" value="Exponentiation -- Title passed from HTML"> <param name="param2" value="2"> <param name="param3" value="10"> </applet> </html>
     Q001:  The "param" clause contains (2) items.  One of them is "name" 
            which creates a global name (available to both HTML and Java)
            for the variable passed.    What is the other?         

 

Q002:

Look closely: Are these parameters string or numeric values? Explain.


Q003:

         At this point, do you understand that parameters
         were defined (by name and value) in HTML, that these
         parameters are global (available to other programs)?

         Here is the Java Source Code that defines these
         parameters from the Java side:

          String parameter1;   // save 1st HTM param as String.
          int parameter2;      // 2nd & 3rd parameters defined as integer.
          int parameter3; 

         Explain what "data type" each parameter is defined as:




Q004:

       Here is the Java code that inputs and converts the parameters:

       parameter1 = getParameter("param1"); 
                               // getParameter  "gets"  its  value from HTML
       parameter2 = Integer.parseInt(getParameter("param2")); 
                               // This statement "showcases" power of Java:
                               //  param2 is passed, then converted (parsed)
                               //  into an Integer.   Note nested methods 
                               //  (functions).  Parameters are obviously 
                               //  passed as text, explaining need to 
                               //  convert them.
       parameter3 =  Integer.parseInt(getParameter("param3")); 


        Explain "getParameter()" (look it up).
        Explain "Integer.parseInt" -- what does it do?
        Notice that Java, like JavaScript, operates right to left,
        like algebra,  that is, the operation on the right is done first,
        then that result is operated on by the operation immediately to
        its left.   Comment on this.
               
      


Q005:

 
        Passing Paramenters makes an Applet robust:  you can modify what
        happens inside of it by passing values to it.

        Comment on this.