Internet Programming 1 Flashcards

World Wide Web
Terms Definitions
Apache
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.
W3C (World Wide Web Consortium)
the international body that sets standards for the Web
URL
finds the global addresses of documents and other resources on the web.
HTTP GET
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.
HTTP POST
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.
HTTP Request
asks for information from a specific resource through a request line. GET /path/to/file/index.html HTTP/1.0
HTTP Response
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() 
2xx Status Code
indicates clients request was received, understood, and accepted. Example, HTTP/1.0 200 OK
4xx Status Code
indicates that the request has bad syntax or could not be found. Example - HTTP/1.0 404 Not Found
5xx Status Code
indicates server is aware that there is an error or is incapable of performing the request - ___ Internal Service Error
Stateless
treats every request as an independent request. doesn't have any related any information from the previous request
Cookie
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
Redirect
code used to send a user to another URL - meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/index.html">
Tomcat
JSP translator and an open source software implementation of the Java Servlet and JavaServer Pages technologies.
Public_Html
directory in your home directory where you put files to be displayed by the Apache HTTP server on port 80 (not the Tomcat server)
Idempotent
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.
SSI Server Side Includes
code put into Web pages that is interpreted by the Apache HTTP server
 
example: !--#echo var="DATE_LOCAL" -->
[an error occurred while processing this directive]
Protocol layering principle
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.
XBitHack
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
Caching
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.
Content Negotiation
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.
Form
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.
Input Element
used to select user information. Can be a text, check box, radio button, button, etc.
CSS Selectors
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; }
CSS Properties
features of CSS like font family, font style, font size etc
Container
an HTML element that holds other elements or text
Validator
checks to see if HTML contains error free code
Delimiter
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.
HTTP Form Method
defines how to send the data within the form. For example, the get method and the post method.
Form Action
the URL to which the client is directed after pressing a Submit button
 
form name="input" action="html_form_submit.asp" method="get"
Radio Button
Used when you want the user to select one of a limited number of choices. For example, the table numbers in Cal's Cafe.
Submit Element
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>
Servlet
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.
JSP
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.
Java Bean
communicates with the JSP with variables and parameters. Stored in the server, uses a constructor method, and getter and setter methods
DBMS
Computer program that is designed to manage the database components associated with an application.
Presentation Layer
represents the interface between the user and the rest of the application
Business Layer Rule
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
Data Access Layer
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.
Error Page
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.
Web.xml
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.
WAR File (Web Application Archive)
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.
Class Library
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.
ANT (Another Neat Tool)
Java-based tool for automating the testing and assembly of Java programs (Web apps for us)
Build.xml
ANT uses an XML file to control the build process and its dependencies
ANT target
a milestone to be reached or set of tasks to be accomplished
ANT task
a specific command represented by an element in build.xml, such as compiling a set of files
JUnit Test
Testing capabilities for us to write tests for our java application. instance.getXXX assertEquals("", instance.getXXX);
Java Class
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".
Java Package
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.
Scriptlet
contains Java code that is executed every time the JSP is invoked. Example, everything in the <%  tag
JSTL (JavaServer Pages Standard Tag Library)
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.
Expression Language
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
jsp:GetProperty
 
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 .
jsp:setProperty
 
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
sessions
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 );%>
session scope
all the values the user entered will be stored until the user kills the session
application scope
all the values the user entered will be stored until the application is over
HTTPServlet
_____ 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.
Redirect
where the web application instructs the browser to fetch a second URL, which differs from the originala browser reload of the second URL will not repeat the original request, but will rather fetch the second URLredirect is marginally slower than a forward, since it requires two browser requests, not oneobjects placed in the original request scope are not available to the second request
Servlet Mapping
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.
doGet
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).
doPost
called in response to an HTTP POST request.
setContentType
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
View
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
request Object
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.
response Object
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
servletContext
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
cookie
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
Session ID
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
URL Rewriting
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.
Hidden Field
allow you to send additional information with a submitted form that don't necessarily require a user to "fill them out."
public ConnectionTest() { try { Class.forName("com.mysql.jdbc.Driver");
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
system level classes - holds all the drivers - asking it to give connection to the URL and the password - DriverManager is just there.
 


conn = DriverManager.getConnection(jdbcURL,user,password);
deprecation
old and out of date code that you may have to deal with
where the classes of the source code reside
pathelement path="./deploy/WEB-INF/classes"
 


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.
testGetCell1() { System.out.println(“getCell1”); instance = new GameBoardBean(); assertEquals(“ “,instance.getCell1()); instance.setUserMove(2); assertEquals(“ “,instance.getCell1()); instance.setUserMove(1); assertEquals(“X“,instance.getCell1()); }
JSP Expression Language
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}
To “wire” a JavaBean to a JSP page
 
${helloBean.userName}!
 
jsp:setProperty
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.
The code lives on the server.
 
 


why cant we see the JSP code in viewsource?
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.
 


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

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


When you click 'submit' what properties are going to be sent from jsp to java bean in Cals Cafe?
Interface or abstract class
List, Map
Implementing Class
ArrayList, HashMap are examples of an _______ class
Request Variables: (set) in Cals Cafe
Patron name - StringTable number - intCommand - three different values String
State Variables: (get) in Cal's Cafe
Patrons at Tables - String []Patrons on waiting list - String []
 


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 ag
Why use a JUnit test?
Right Click java file -> Tools -> Create JUnit tests
 


How to create JUnit test?
Model
domain-specific representation of the data upon which the application operates.
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
What does this code mean?
 
 

     c:forEach items="${manager.waitingList}" var="waitingList"
        tr td class="white">${waitingList}</td/tr
    /c:forEach
 
 


black box syndrome
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.
Model View Controller for Cal's Cafe
Unit Testing to avoid “Black Box” syndrome
Sublayers of Model: Business processes and entities
Bean Properties set by the JSP
Receiving the Properties - the setXXX methods are automatically generated by Netbeans using Refactor - Encapsulate Fields
Carrying out the Command - Command is the last property to be set
JSP Expression Language
JSTL Core Tag Library
1. returns the result of getTables(), which is an ArrayList of Table Objects;
 
2.  Return the results of Table.getTableName and table.getTableStatus.
Use of c:if to show a “Clear Table” button only if table is occupied
Each row contains a separate form so that those properties in this form get sent to managerBean
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.
JavaBean is a Java class that
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
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.
<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 - T
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 c
/ 110
Term:
Definition:
Definition:

Leave a Comment ({[ getComments().length ]})

Comments ({[ getComments().length ]})

{[comment.username]}

{[ comment.comment ]}

View All {[ getComments().length ]} Comments
Ask a homework question - tutors are online