click below
click below
Normal Size Small Size show me how
Servlets
Question | Answer |
---|---|
public class HelloServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | doPost will will help us with the POST HTTP method |
public class HelloServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } | The doPost method will be overriden if we want to use it |
#first { background-color: skyblue; padding: 40px; } .second { color: aquamarine; font-weight: 800; } | #first is going to target an id in the HTML file for styling |
<!DOCTYPE html> <html> <head> <style> body { background-color: grey; } h1 { color: white; } p { font-weight: bold; color: blue; } </style> </head> <body> <h1>Hello</h1> </body> </html> | The p style does nothing |
<!DOCTYPE html> <html> <head> <style> body { background-color: grey; } h1 { color: white; } </style> </head> <body> <h1>Hello!</h1> </body> </html> | This way of applying CSS styles is called Internal |
<servlet> <display-name>HelloWorldServlet</display-name> <servlet-name>HelloWorldServlet</servlet-name> <init-param> <param-name>Hello</param-name> <param-value>Hi</param-value> </init-param> </servlet> | We use <init-param> to store any particular data which is only used in this servlet |
<servlet> <servlet-name>servlet1</servlet-name> <servlet-class>com.revature.MyFirstServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>servlet1</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> | We are using the <servlet-mapping> to map the servlet to an URL |
<servlet> <servlet-name>servlet1</servlet-name> <servlet-class>com.revature.MyFirstServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>servlet1</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> | The <url-pattern></url-pattern> indicates what the servlet points to |
<html> <head> <link rel="stylesheet" href="style.css"/> </head> <body> </div> </body> </html> | It is using an external css stylesheet |
<ul> <li>Hello</li> <li>Hi</li> <li>Howdy</li> </ul> | The webpage will render a list of bullet points |
<ol> <li>Hi</li> <li>Hello</li> <li>Howdy</li> </ol> | Creates a list render as 1, 2, 3 |
<p>Something <a href="www.google.com">Click here!</a></p> | A link to go to www.google.com |
Which are the correct REST Constraints? Choose all that are correct. | Uniform Interface Cacheable |
What is the CSS Box Model from outside to inside? | Margin -> Border -> Padding -> Content |
What are some CSS attributes? Choose all that are correct | Background C Margin C Padding 0 Color C |
What is the Front Controller Design Pattern? | All requests will be handled by a single handler instead of multiple handlers |
What is a web client? | Web client is our front end |
What is a web server? | It can refer to either hardware or software or both |
What is the correct description about HTML semantic tags? | Used to define the different parts of a webpage and how elements are grouped |
What are some tags in HTML? Choose all that are correct | <html> C <h1> C <div> C |
What is correct about Java Servlet Annotations? | We can use annotations in place of the web.xml |
What is ServletContext? | Use ServletContext when the whole application needs information shared by it |
What is ServletConfig? | ServletConfig is specific to a servlet |
What is the Servlet Container? Choose all that are correct | The container processes the HTTP requests 0 The servlet container has Servlets in it C Tomcat is a Java servlet container C |
Which one is the correct way to select an element to be styled by its ID? | By using the # operator followed by the id name. Ex. #elementToBeStyled |
What is the web.xml file? Choose all that are correct | web.xml is a deployment descriptor You can use web.xml to map URL paths to a servlet class |
What are some HttpServlet Methods? Choose all that are correct | doGet C doPost C doPut C |
What is the correct description for 300s HTTP status codes? | Redirectional messages |
What is the correct description of 100s for an HTTP status code? | Informational Responses |
Which of the following options is the correct precedence for CSS? | Inline overrides internal overrides external |
What is REST? | Representational State Transfer |
What is HTML? | It is used for creating webpages C Hyper Text Markup Language C You can use HTML to send HTTP requests 0 |
What is correct about HTTP status codes? | Developers get to know what went wrong or right with the HTTP request/response |
What is a Servlet? Choose all that are correct | Servlets are used with HTTP requests C Servlet is an interface C GenericServlet is a class 0 |
A benefit of describing data with a language like XML is… | A and B are correct The recipient application does not need to be written in the same language as the application that sent the data The sender and recipient can use schemas to validate the structure of sent or received data |