BCIS 3680 Exam 2 Study Guide
Constructor
A block of code that initializes the newly created object. Resembles an instance method in java but it's not a method as it doesn't have a return type.
Override
When a method in a subclass has the same return type and signature as a method in its superclass (in other words, they have identical header), then the method in the subclass is said to ______________ the method in the superclass.
catalina run
Which of the following starts Tomcat?
<input type="checkbox" name="java" CHECKED>Java</input> <input type="checkbox" name="C#">C#</input> <input type="checkbox" name="Perl">Perl</input> <input type="checkbox" name="Ruby" CHECKED>Ruby</input>
Checkbox; languages: Java checked, C#, Perl, Ruby checked;
Getter design
public int getNumber() { return this.number; }
Setter design
public void setNumber(int num) { this.Number = num; }
Client-side scripting
- You often want to validate the input using JavaScript - You pass the information to the server
Name, action, method
3 most important attributes of the <form> tag
Name
<form> tag attribute: Required if you have multiple forms on the same page
Method
<form> tag attribute: Specify how to send form to the Web server, either POST or GET
Action
<form> tag attribute: Specify the destination file where the form is processed. It can be a Java servlet, a JSP page, or an ASP.NET page, etc.; if you don't specify the __________, the form will do nothing
Method overriding
Applies solely to subclasses that inherit from other classes
Method overloading
Applies to any Java class and is not specifically related to the concept of inheritance
The server.xml file in the C:\Tomcat\conf folder.
By default, many important settings for Apache Tomcat, including the web application contexts (aliases), are controlled by ____________ (assuming that Tomcat is installed in C:\Tomcat).
GET vs POST
If it's a get, the query string is appended (a question mark, followed by name-value pairs in the format of fieldName=fieldValue, separated by ampersands). If it's a post, nothing will be appended to the URL.
Default welcome file
In the Tomcat jargon, a default page is a "welcome file"
Scriptlet Opening tag: <% Closing tag: %>
One or more complete Java statements grouped together logically
<p>Gender: <input type="radio" name="gender" value="M">Male</input> <input type="radio" name="gender" value="F">Female</input></p>
Radio button; gender
Expression Opening tag: <%= Closing tag: %>
Segment of Java statement that resolves to a String value
<input type="submit" name="Submit" value="Submit thru Secure Server">
Submit button; text: submit thru secure server
Directive Opening tag: <%@ Closing tag: %>
Special instructions; e.g., The "import" attribute of the "page" ______________ is equivalent to the import statement in Java
<input type="text" name="firstName" />
Textbox; firstName
Servlet
What is a JSP page converted into before it is run?
Polymorphism
What is the OOP principle that allows a subclass object to be stored in a reference variable of the superclass type?
<Host>
When you define a context for Tomcat, you want to create a <Context> element (tag) and make it a child of the ____________ element.
<head>
Where do you place JavaScript functions in HTML?
To achieve encapsulation
Why do we use getter and setter methods?
Subclass syntax
class Child extends Parent
Constructor design
class Customer { String name; double salesAmount; Customer() { name = "undefined"; salesAmount = 0.0; } }
Server-side scripting
- The server processes user input, creates dynamic contents based on the input, and writes the HTML code - The server passes the generated code back to the client - The client's browser displays the HTML code from the server
<a href="login.html">Login</a>
<a> tag; login
<select name="Icecream Flavors"> <option value="double chocolate">Double Chocolate</option> <option value="vanilla">Vanilla</option> <option value="strawberry" selected>Strawberry</option> <option value="caramel">Caramel</option> </select>
Dropdown list; icecream flavors; double chocolate, vanilla, strawberry (selected), caramel;
correct syntax to instantiate an object
Element 0 = arrayName[0] Element i = arrayName[i] Last element = arrayName[arrayName.length - 1]
Declaration Opening tag: <%! Closing tag: %>
Equivalent to a method in a Java class
When the form is submitted each piece of user input are passed as a parameter.
How is a <form> passed from one page to another?
<Context> element setup
Inside the "Host" element (tag), (in server.xml) modify the "Context" element. For example: <Context path="/kordzis03" docBase ="C:\Users\scott\OneDrive\Desktop\3680-HW3-Kordzi-Scott"/>
location and role of the server.xml
This PC --> Local Disk (C:) --> Apache Tomcat 8.0.27 --> conf --> server The Web server receives the page request and locates the .htm/html page in local file system. The Web server sends the HTML stream back across the Internet to the client browser.
location and role of the web.xml
This PC --> Local Disk (C:) --> Apache Tomcat 8.0.27 --> conf --> web A web application consists of a collection of files that are required to support a particular feature or task you want to publish to the outside world
It is not a complete Java statement.
Which of the following is true regarding a JSP expression?
Static variables/methods
variables/methods that can be used throughout the program
Instance variables/methods
variables/methods that can only be used in the class