Shared Flashcard Set

Details

Internet Programming 1
Vocabulary list and Code Snippets for Web Programming
110
Computer Science
Graduate
03/02/2010

Additional Computer Science Flashcards

 


 

Cards

Term
Apache
Definition
The Software Foundation provides support for the community of open-source software projects. The projects are characterized by a collaborative, consensus based development process, an open and pragmatic software license, and a desire to create high quality software that leads the way in its field.
Term
W3C (World Wide Web Consortium)
Definition
the international body that sets standards for the Web
Term
URL
Definition
finds the global addresses of documents and other resources on the web.
Term
HTTP GET
Definition
Choosing GET as the "method" will append all of the data to the URL and it will show up in the URL bar of your browser. The amount of information you can send back using a GET is restricted as URLs can only be 1024 characters.
Term
HTTP POST
Definition
submits data to be processed. posts a value to the server. For example, putting values into a sever data like credit card. more secure method cant be seen in URL.
Term
HTTP Request
Definition
asks for information from a specific resource through a request line. GET /path/to/file/index.html HTTP/1.0
Term
HTTP Response
Definition
HTTP::_____class encapsulates HTTP style responses. A ____ consists of a ______ line, some headers, and a content body. Note that the LWP library uses HTTP style ______even for non-HTTP protocol schemes. Instances of this class are usually created and returned by the request() 
Term
2xx Status Code
Definition
indicates clients request was received, understood, and accepted. Example, HTTP/1.0 200 OK
Term
4xx Status Code
Definition
indicates that the request has bad syntax or could not be found. Example - HTTP/1.0 404 Not Found
Term
5xx Status Code
Definition
indicates server is aware that there is an error or is incapable of performing the request - ___ Internal Service Error
Term
Stateless
Definition
treats every request as an independent request. doesn't have any related any information from the previous request
Term
Cookie
Definition
text file created by your browser that stores information to your computer. Used because HTTP is a stateless protocol. _____ creates stateful sessions. Used for preferences, shopping cart, authentication
Term
Redirect
Definition
code used to send a user to another URL - meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">
Term
Tomcat
Definition
JSP translator and an open source software implementation of the Java Servlet and JavaServer Pages technologies.
Term
Public_Html
Definition
directory in your home directory where you put files to be displayed by the Apache HTTP server on port 80 (not the Tomcat server)
Term
Idempotent
Definition
a math term that means doing something twice has the same effect as doing it once. This should be true of HTTP GET requests but not HTTP POST requests. For example, viewing a catalog in an online store can be a GET operation, but charging your credit card should not be a GET operation.
Term
SSI Server Side Includes
Definition

code put into Web pages that is interpreted by the Apache HTTP server

 

example: !--#echo var="DATE_LOCAL" -->

Term
Protocol layering principle
Definition
Network architectural principle that says that protocols should call on lower-layer protocols. In our case, HTTP, an application layer protocol, uses the services of TCP, a transport-layer protocol.
Term
XBitHack
Definition
A trick used on Web servers to allow the server to detect the presence of Server-side Include statements in Web pages without having to scan through every document. If the document file’s execute bit is set, the server will scan the file for SSI statements
Term
Caching
Definition
Saves response files when a user is involved with a browsing session. Makes the web seem faster because just retrieves info quickly. For example, back button on the browser. _____ also reduces network traffic.
Term
Content Negotiation
Definition
mechanism defined in the HTTP specs that make it possible to serve different versions of a document or resource so the user agents (browser) can specify which version fits their needs. For example, show the URL in french first, but if not english is okay. Also, show a GIF images in IE because it doesnt allow displaying PNG images.
Term
Form
Definition
used to select different kinds of user inputs. Example - Contact Form. A ____ contains elements within the form like drop down menus, check boxes, and submit buttons.
Term
Input Element
Definition
used to select user information. Can be a text, check box, radio button, button, etc.
Term
CSS Selectors
Definition
selects elements on an HTML page so that they can be styled. For example, when bold or emphasized text, the CSS will look like - em {color: blue; }
Term
CSS Properties
Definition
features of CSS like font family, font style, font size etc
Term
Container
Definition
an HTML element that holds other elements or text
Term
Validator
Definition
checks to see if HTML contains error free code
Term
Delimiter
Definition
sequence of one or more characters used to specify a boundary between data steams or separate regions. Example, a comma is used to separate values.
Term
HTTP Form Method
Definition
defines how to send the data within the form. For example, the get method and the post method.
Term
Form Action
Definition

the URL to which the client is directed after pressing a Submit button

 

form name="input" action="html_form_submit.asp" method="get"

Term
Radio Button
Definition
Used when you want the user to select one of a limited number of choices. For example, the table numbers in Cal's Cafe.
Term
Submit Element
Definition

submits all the information obtained into the form, sending it to the specified place

 

form method="get">input type="hidden" name="tableNumber" value="3">

             input type="submit" name="command" value="Clear table"/form>

Term
Servlet
Definition
a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers. For such applications, Java Servlet technology defines HTTP-specific servlet classes.
Term
JSP
Definition
may be viewed as a high-level abstraction of Java servlets. ____ are loaded in the server and operated from a structured special installed Java server packet called a J2EE Web Application often packaged as a .war or .ear file archive. ____ allows Java code and certain pre-defined actions to be embedded into static page content and compiled on the server at runtime of each page request.
Term
Java Bean
Definition
communicates with the JSP with variables and parameters. Stored in the server, uses a constructor method, and getter and setter methods
Term
DBMS
Definition
Computer program that is designed to manage the database components associated with an application.
Term
Presentation Layer
Definition
represents the interface between the user and the rest of the application
Term
Business Layer Rule
Definition
layer that contains the Business logic and / or Business rules of the application. Reserving a separate layer strictly for Business logic in an N-Tier architecture is a major advantage, in that any changes that need to be made to Business rules can be made here without having any effect on other applications
Term
Data Access Layer
Definition
a layer of a computer program which provides simplified access to data stored in persistent storage of some kind, such as an entity-relational database. For example, the _____ might return a reference to an object (in terms of object-oriented programming) complete with its attributes instead of a row of fields from a database table.
Term
Error Page
Definition
the page that displays when an HTTP request is not fulfilled. must be user friendly and tell the problem accurately. See 2xx - 5xx error messages.
Term
Web.xml
Definition
provides configuration and deployment information for the Web components that comprise a Web application. Examples of Web components are servlet parameters, servlet and JavaServer Pages (JSP) definitions, and Uniform Resource Locators (URL) mappings.
Term
WAR File (Web Application Archive)
Definition
a file used to distribute a collection of JavaServer Pages,servlets, Java classes, XML files, tag libraries and static Web pages (HTML and related files) that together constitute a Web application.
Term
Class Library
Definition
set of dynamically loadable libraries that Java applications can call at runtime. Because the Java Platform is not dependent on any specific operating system, applications cannot rely on any of the existing libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries, containing much of the same reusable functions commonly found in modern operating systems.
Term
ANT (Another Neat Tool)
Definition
Java-based tool for automating the testing and assembly of Java programs (Web apps for us)
Term
Build.xml
Definition
ANT uses an XML file to control the build process and its dependencies
Term
ANT target
Definition
a milestone to be reached or set of tasks to be accomplished
Term
ANT task
Definition
a specific command represented by an element in build.xml, such as compiling a set of files
Term
JUnit Test
Definition
Testing capabilities for us to write tests for our java application. instance.getXXX assertEquals("", instance.getXXX);
Term
Java Class
Definition
construct that is used as a blueprint (or template) to create objects of that class. This blueprint describes the state and behavior that the objects of the class all share. An object of a given class is called an instance of the class. The class that contains (and was used to create) that instance can be considered as the type of that object, e.g. an object instance of the "Fruit" class would be of the type "Fruit".
Term
Java Package
Definition
mechanism for organizing Java classes into namespaces similar to the modules of Modula. _____ can be stored in compressed files called JAR files, allowing classes to download faster as a group rather than one at a time. Programmers also typically use packages to organize classes belonging to the same category or providing similar functionality.
Term
Scriptlet
Definition
contains Java code that is executed every time the JSP is invoked. Example, everything in the <%  tag
Term
JSTL (JavaServer Pages Standard Tag Library)
Definition
encapsulates as simple tags the core functionality common to many Web applications. ____ has support for common, structural tasks such as iteration and conditionals, tags for manipulating XML documents, internationalization tags, and SQL tags. It also provides a framework for integrating existing custom tags.
Term
Expression Language
Definition
makes it possible to easily access application data stored in JavaBeans components. For example, the JSP _____ allows a page author to access a bean using simple syntax such as ${name} for a simple variable or ${name.foo.bar} for a nested property
Term

jsp:GetProperty

 

Definition
Gets the value of a Bean property so that you can display it in a result page. Gets a Bean property value using the property's getter methods and displays the property value in a JSP page. You must create or locate a Bean with before you use .
Term

jsp:setProperty

 

Definition
sets the value of one or more properties in a JavaBean component, using the Bean's set methods. You must use a tag to declare the Bean before you use. The value of name in must match the value of id in
Term
sessions
Definition
an object associated with a visitor. Data can be put in the session and retrieved from it, much like a Hashtable. A different set of data is kept for each visitor to the sitesession is an object associated with a visitor. Data can be put in the session and retrieved from it, much like a Hashtable. A different set of data is kept for each visitor to the site. Example - <%
String name = request.getParameter( "username" );
session.setAttribute( "theName", name );
%>
Term
session scope
Definition
all the values the user entered will be stored until the user kills the session
Term
application scope
Definition
all the values the user entered will be stored until the application is over
Term
HTTPServlet
Definition
_____ class extends GenericServlet to provide an HTTP protocol specific implementation of Servletinterface. If your Servlet has to work with HTTP protocol you should simply extend the class and override the methods you need.
Term
Redirect
Definition
where the web application instructs the browser to fetch a second URL, which differs from the original
a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
redirect is marginally slower than a forward, since it requires two browser requests, not one
objects placed in the original request scope are not available to the second request
Term
Servlet Mapping
Definition
specifies the web container of which java servlet should be invoked for a url given by client. It maps url patterns to servlets. When there is a request from a client, servlet container decides to which application it should forward to. Then context path of url is matched for mapping servlets.
Term
doGet
Definition
called in response to an HTTP GET request. This happens when users click on a link, or enter a URL into the browser's address bar. It also happens with some HTML FORMs (those with METHOD="GET" specified in the FORM tag).
Term
doPost
Definition
called in response to an HTTP POST request.
Term
setContentType
Definition
sets the copy of a web application. for example, ______('html/text') or _____('application/pdf'); Controller Servlet - which behaves as a gateway for all incoming requests & outgoing responses. But, keep the business logic away from this servlet. Implement the business logic in separate module or a class
Term
View
Definition
Simple component you may use for images view. For example, in your JSP files you may decide to show images that are outside of the web root
Term
request Object
Definition
Defines an object to provide client request information to a servlet. The servlet container creates a _____ and passes it as an argument to the servlet's service method.
Term
response Object
Definition
Client metadata is encapsulated as an object of type HttpServletResponse and is called ____. The Servlet engine passes both objects as parameters to the Servlets service() method
Term
servletContext
Definition
defines methods that allow a servlet to interact with the host server. This includes reading server-specific attributes finding information about particular files located on the server and writing to the server log files. I f there are several virtual servers running each one may return a different Servllet
Term
cookie
Definition
small piece of text stored on a user's computer by a web browser. A ____ consists of one or more name-value pairs containing bits of information. The ____ is sent as an HTTP header by a web server to a web browser and then sent back unchanged by the browser each time it accesses that server. A _____ can be used for authentication, session tracking (state maintenance), storing site preferences, shopping cart contents, the identifier for a server-based session, or anything else that can be accomplished through storing textual data
Term
Session ID
Definition
piece of data that is used in network communications (often over HTTP) to identify a session, a series of related message exchanges. Session identifiers become necessary in cases where the communications infrastructure uses a stateless protocol such as HTTP. For example, a buyer who visits a seller's site wants to collect a number of articles in a virtual shopping cart and then finalize the shopping spree by going to the site's checkout page
Term
URL Rewriting
Definition
used to provide shorter and more relevant-looking links to web pages. The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the world.
Term
Hidden Field
Definition
allow you to send additional information with a submitted form that don't necessarily require a user to "fill them out."
Term
public ConnectionTest() {
try { Class.forName("com.mysql.jdbc.Driver");
Definition
Class names start with uppercase. Class is a class whose name is Class
// way for Java to get at info and operations with what class something is
// static method -
// What it means - method that creates instance of a class by telling instance of the class. // "com.mysql.jdbc.Driver" - package - Driver is special set of code allows program to connect to some entity
Term

system level classes - holds all the drivers - asking it to give connection to the URL and the password - DriverManager is just there.


Definition

 

conn = DriverManager.getConnection(jdbcURL,user,password);

Term
deprecation
Definition
old and out of date code that you may have to deal with
Term


where the classes of the source code reside

Definition
pathelement path="./deploy/WEB-INF/classes"
Term

 

this test code verifies that the contents of cell 1 start at blank, stay blank when we set some other cell as the user move, and becomes “X” when we set cell 1 as the user move.

Definition

testGetCell1() { System.out.println(“getCell1”); instance = new GameBoardBean(); assertEquals(“ “,instance.getCell1()); instance.setUserMove(2); assertEquals(“ “,instance.getCell1()); instance.setUserMove(1); assertEquals(“X“,instance.getCell1()); }


Term
JSP Expression Language
Definition
provides a less cumbersome and more flexible way to embed Bean properties into your JSP page. To enable EL, add the following code to index.jsp. As suggested by the comment, go to the Projects window and right-click the Libraries folder. Example - ${helloBean.userName}
Term

To “wire” a JavaBean to a JSP page

 


Definition

${helloBean.userName}!

 

Term
jsp:setProperty
Definition
doesnt take any effect until someone clicks the submit button then sends the userName.  The _______ directive does not immediately send the userName property over to our Bean. Instead, the property will be sent when a form containing a userName input element is submitted.
Term
The code lives on the server.
Definition

 

 

why cant we see the JSP code in viewsource?

Term
The information has a short lifetime. Doesn't have to know any history as opposed to the restaurant which contains info that had to be saved.
Definition

 

why doesn't JSP say scope = session in Cal's Cafe?

 

Term
.equals
Definition
assigment operator
Term
==
Definition
comparrison operator
Term
command, patron name, table number
Definition

 

 

When you click 'submit' what properties are going to be sent from jsp to java bean in Cals Cafe?

Term
Interface or abstract class
Definition
List, Map
Term
Implementing Class
Definition
ArrayList, HashMap are examples of an _______ class
Term
Request Variables: (set) in Cals Cafe
Definition
Patron name - String
Table number - int
Command - three different values String
Term
State Variables: (get) in Cal's Cafe
Definition
Patrons at Tables - String []
Patrons on waiting list - String []
Term

 

Unit tests allow you to write code faster while increasing quality - When you write tests using JUnit, you'll spend less time debugging, and you'll have confidence that changes to your code actually work. This confidence allows you to get more aggressive about refactoring code and adding new features. JUnit tests check their own results and provide immediate feedback - Testing is no fun if you have to manually compare the expected and actual result of tests, and it slows you down. JUnit tests can be run automatically and they check their own results. When you run tests, you get simple and immediate visual feedback as to whether the tests passed or failed. There's no need to manually comb through a report of test results. JUnit tests increase the stability of software - fewer tests you write, the less stable your code becomes. Tests validate the stability of the software and instill confidence that changes haven't caused a ripple-effect through the software. The tests form the glue of the structural integrity of the software.

Definition
Why use a JUnit test?
Term
Right Click java file -> Tools -> Create JUnit tests
Definition

 

How to create JUnit test?

Term
Model
Definition
domain-specific representation of the data upon which the application operates.
Term

1. Connects to the JSTL library using scriplet with prefix="c"

2.  The forEach statement will loop through the waitingList array looking for each value defined in beans.TableManagerBean.

3.  The JSP page then will display every value it finds in the waitingList array in an HTML table. 

Definition

What does this code mean?

 

 


     c:forEach items="${manager.waitingList}" var="waitingList"

        tr td class="white">${waitingList}</td/tr

    /c:forEach

 

Term

 

black box syndrome

Definition
What is is called when our JSP and JavaBean classes are embedded in an extremely complex server If an error occurs, it’s hard to figure out where.
Term
Model View Controller for Cal's Cafe
Definition
[image]
Term
Unit Testing to avoid “Black Box” syndrome
Definition
[image]
Term
Sublayers of Model: Business processes and entities
Definition
[image]
Term
Bean Properties set by the JSP
Definition
[image]
Term
Receiving the Properties - the setXXX methods are automatically generated by Netbeans using Refactor - Encapsulate Fields
Definition
[image]
Term
Carrying out the Command - Command is the last property to be set
Definition
[image]
Term
JSP Expression Language
Definition
[image]
Term
JSTL Core Tag Library
Definition
[image]
Term

1. returns the result of getTables(), which is an ArrayList of Table Objects;

 

2.  Return the results of Table.getTableName and table.getTableStatus.

Definition
[image]
Term
Use of c:if to show a “Clear Table” button only if table is occupied
Definition
[image]
Term
Each row contains a separate form so that those properties in this form get sent to managerBean
Definition
[image]
Term

1. Has a no-argument constructor, allowing it to be automatically instantiated when the Web app launches;

2. “get” and “set” methods to communicate with other Web app components, in this case JSP pages.

Definition
JavaBean is a Java class that
Term

To “wire” a JavaBean to a JSP page, use <jsp:  tags as shown here. Netbeans will help with code completion:


a.       The “id” attribute of <jsp:useBean  is the local name by which the HelloBean object will be known in the rest of the jsp tags in this page.


b.      The “scope” attribute defines how long the Bean will retain its values. The userName property needs to last only through one request/response cycle, so we set the scope to “request” or leave it out altogether.


c.       In the <jsp:setProperty tag, “helloBean” is now  the value of the name attribute, rather than id.

Definition
[image]
Term
To get the userName property from our Bean using the <jsp:getProperty tag. Again, the name attribute is “helloBean”. Note that by convention, the “userName” property is accessed through the setUserName and getUserName methods in the Bean.
Definition
[image]
Term
<jsp:setProperty directive does not immediately send the userName property over to our Bean. Instead, the property will be sent when a form containing a userName input element is submitted. Let’s create a form to send a userName property to the Bean - This time, you should be able to enter your name and be personally greeted!
Definition
[image]
Term

replace the clunky <jsp:getProperty tag with this code.  

 

Expression language expressions are incased in ${…} and can reference not only JavaBeans, but other resources such as your session and request params. There is a link to an EL page on our course Web site. In my experience, I have found it more convenient to keep all the data needed by your JSP page in JavaBeans whenever possible.

Definition
[image]
Supporting users have an ad free experience!