Lecture 2A Flashcards
What are scoped variables?
For storing and sharing data in server memory. Across an entire session instead of surrounding method (doPost() doGet()). Data objects put in scope (a map) in main memory.
How long does session last?
Until user closes browser or server is stopped.
What are the two main methods to create and access scoped variables?
Scope.setAttribute() and scope.getAttribute()
Code for using sessions scoped variable:
Request.getSession().setAttribute(name, value);
JSP? JSF?
Java Server Pages, Java Server Faces. JSPs are translated into servlets at runtime. Like HTML pages which contain Java Code - scriptlets,
How to write scriptlets:
Pros of using JSP’s
Content and display logic seperate, automatic deployment (recompile automatically), uses javabeans, easy to do html, platform independent.
JSP expressions:
Also: Expression
JSP scriptlets:
Also: code
JSP declaration:
JSP actions:
Write basic import statement for servlet extras
Import javax.servlet.http.HttpServlet;