JSP and Servlet
Java Server Pages and Servlets
what’s Servelet ?
Servlet is the type of class used to make a dynamic web page using java code
how we can make a servlet
a simple servlet class can be done by implementing the Servlet interface
but usually we use the servlet in an HTTP conection to make an HTTP response to the user in a form of HTML page, in this case it’s better to use HttpServlet abstract class
Struts is a java framework for web implements the MVC design pattern.
Struts facilitates the work of page redirection, form submitting, data validation and much more.
a common scenario is a login page
login.jsp that contains two inputs user name and password
a simple java class/bean that maps this information ( has two properties username and password)
an action servlet that receives the login page data and put them into the bean
then make a specific action (Logining) after that redirecting to another page (success page or return to the login page if error happened)
A breadcrumb / navigation menu should track all the moves of the user from a page to another
the concept of making a dynamic navigation menu is to save every visited page in a list so that it contains all the visited pages from the home page until the current page
when i click on any menu item (return to a previous page on my navigation) i should clear all the pages after this page from the list.
user visits history should be stored among all user requests and should be unique to every user, so we would store navigation information in Session scope
The Tag interface is the main interface in custom tags
we can make our own custom tag by implementing this interface
When the container evaluates the custom tag, it first pass the PageContext object of the current page and the parent Tag of this custom tag.
Then the container calls the doStartTag that decides to include or skip the body of the tag then it calls the doEndTag that decides to continue parsing the rest of the page or to stop.
The tag is used many times by the container before it got out of service then the containers calls release method.