Week 3 - HTML, XML, Servlets

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is a DTD?

-A document that standardizes an XML document with rules. -Get a standard to trade XML within a company. -Guarantees "valid" XML.

HTML attributes are where?

-Always nested within a tag/element. -All elements can have attributes. -Provides additional info for element.

What does <load-on-startup> do?

-Preloads a servlet.

What is a RequestDispatcher?

-Transfer to other resources within same server. -Transition is handled within the container. -New location hides address. -Uses the request/response, so data is maintained. -Faster.

If the XML has a prolog, where does the DTD go?

After the prolog.

What makes Valid XML?

Any Well Formed XML that also follows the rules of a DTD or xmlschema properly.

DOM stands for

Document Object Model

HTML stands for

HyperText Markup Language

What is metadata?

Information that is held as a description of stored data.

How many root tags can XML have?

One root tag.

Convention dictates what case of letters for HTML elements and why?

Only lower case letters. Elements are case-sensitive.

What are the JSP Scopes, from most to least specific?

Page Request Session Application

Why use a GET over a POST?

The GET method is faster and can be changed in the URL, so it's good for search queries. The POST method hides the info so it's good for forms and other private information.

The Servlet Inheritance Tree

The servlet extends the abstract class HttpServlet to gain its http protocol methods. HttpServlet extends the abstract class GenericServlet. GenericServlet implements ServletConfig, Servlet, and Serializable.

XML stands for

eXtensible Markup Language

What is a ServletContext?

-A shared resource for all servlets. -Holds info accessible by all servlets. -Scope is application wide (1 context per server).

HTML does what?

-Describes the structure of a webpage using markup. -Utilizes tags (elements) which make up the building blocks of a webpage. -Aims to display data.

What's the difference between GET and POST?

-GET stores the info at the end of the URL while POST stores the info in the message body. -GET has a max size of 1024 bytes (1kb), while POST has no size limit.

What is a Servlet?

-Java servlets are programs that run on a web/application server that act as a middle layer between a request form a client(browser) and database or application on the server. -Allows us to collect input from forms, present records from a database, or create webpages dynamically.

What would be put in the <head> tag/element of an HTML doc?

-Provides space for importing scripts or external files (referenced before body). -Provides metadata for site.

How, when, and why do you preload a servlet?

-Put the <load-on-startup> in the deployment descriptor. -Within <servlet> use <load-on-startup> # </load-on-startup> # specifies priority of loading in the case multiple servlets. 1

Servlet Tasks

-Read implicit(metadata) / explicit(form data) data sent from client. -Process data, then generate the result. -Send implicit/explicit data back.

GET method

-Sends encoded info appended to the page request. -Information itself is stored at the end of the URL. -URL included, max size is 1024 bytes. -Stored in Query_String header parameter.

POST method

-Sends encoded info appended to the page request. -Information itself is stored in message body. -No size limit. -Stored in Query_String header parameter.

What makes HTML a programming language?

It's not a programming language, dumb*ss.

What are the implicit objects of JSPs?

SEACRROPP Session Exception Application Config Request Response Out Page PageContext

Why use an XML namespace?

-To avoid clashing with other tags for other markup languages, we can use prefixes offered by namespaces.

What is a SendRedirect?

-Transferring to a different server or domain. -Request goes back to client. -New location visible in url. -Resources lost, since a new request is sent. -Slower.

Session Tracking

-URL rewriting. -Hidden Forms. -Cookies. -Session Objects.

What is a ServletConfig?

-Unique to each servlet. -Holds info pertaining to a servlet. -Scope limited to that of the servlet.

What makes Well Formed XML?

-XML with correct syntax. -Only 1 root tag. -May have a prolog. -All elements must have closing tags. -Attributes must be quoted. -No overlapping end tags.

What's the difference between DTD and xmlschema?

-Xmlschema is stronger than DTD. -xs is easier to describe content. -xs supports namespace and datatypes. -Schema follows rules of a DOM, therefore XML schemas are parsable.

Every HTML document starts with what? Why?

<!DOCTYPE html> -<!DOCTYPE> is not an HTML tag. -It is an instruction to the web browser about what version of HTML the page is written in.

How do you set up a DTD?

<!DOCTYPE note System "Note.dtd"> <note> <to> </to> <from> </from> </note> Create the DTD file. Note.dtd <!DOCTYPE note <!Element note(to, from, head, body) </Element> <!Element to(#pcdata)>

How do you define an XML namespace?

<books xmlns:b="books"> <b:table> <b:tr> </b:tr> </b:table> </books> -Within the tag you want to follow a namespace with, apply the following attribute: xmlns:prefix="URI"

Servlet Package

Classes that the servlet uses.

DOM question

DOM answer

DTD stands for

Document Type Definition

What's the difference between HTML and XML, both being markup languages?

HTML aims to display data. XML aims to store/carry data.

XML Parser

Instantiate DOMParser. Parse from XML. Use getElementsByTagName to search for an XML tag name to parse.

What does JSP stand for?

Java Server Pages

What are the six JSP tags?

Scriptlet <% %> Expression <%= %> Comment <%-- --%> Declaration <%! %> Directives @include @taglib @page JSP Actions

Pre-initializing a servlet

Setting servlet parameters before a servlet is active. <init-param> <param-name> <param-value>

Cookies

Text file stored on the client and are kept for tracking information.


Kaugnay na mga set ng pag-aaral

Eco 29 Ch. 21 MyEconLab Questions

View Set

Science- Work and Simple Machines

View Set

CITI - Updates to Expedited Review Procedures

View Set

Chapter 9: Cellular Respiration, Chapter 6, Chapter 5: Membrane Transport & Cell Signaling (Multiple Choice) chp5-8

View Set

GERIATRIC ATI TEST 2ND WEEK ASSESS A RACIEL

View Set