Servlets JSP Reference
Servlets JSP Reference
Servlets JSP Reference
http://www.java-forums.org/ocpjwcd/54105-tutorial-review-web-container-model-services-web-componentdeveloper-exam.html
http://www.beingjavaguys.com/2013/05/difference-between-request-dispatcher.html
http://www.studytonight.com/servlet/servlet-config.php
javax.servlet.ServletConfig;
javax.servlet.ServletException;
javax.servlet.http.HttpServlet;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
<servlet>
<display-name>InitializationParamatersUsingServletConfig</display-name>
<servlet-name>InitializationParamatersUsingServletConfig</servlet-name>
<servlet-class>servletspack.InitializationParamatersUsingServletConfig</servlet-class>
<init-param>
<param-name>companyName</param-name>
<param-value> JumboTheBumbo</param-value>
</init-param>
<init-param>
<param-name>companyEmail</param-name>
<param-value> [email protected]</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>InitializationParamatersUsingServletConfig</servlet-name>
<url-pattern>/InitParamServletConfig</url-pattern>
</servlet-mapping>
</web-app>
http://www.java4s.com/java-servlet-tutorials/example-of-servletconfig-in-java-servlet/
web.xml Deployment Descriptor Elements
http://docs.oracle.com/cd/E13222_01/wls/docs81/webapp/web_xml.html
[Session Tracking]
http://www.developersbook.com/servlets/interview-questions/servlets-interview-questions-faqs.php
http://www.developersbook.com/servlets/interview-questions/servlets-interview-questions-faqs-2.php
http://www.developersbook.com/servlets/interview-questions/servlets-interview-questions-faqs-3.php
http://www.studytonight.com/servlet/session-management.php
http://www.c-sharpcorner.com/UploadFile/0d4935/session-management-using-url-rewritting-instead-of-cookies/
http://www.c-sharpcorner.com/UploadFile/73d82f/session-management-and-cookies-in-java/
http://www.c-sharpcorner.com/UploadFile/0d4935/working-with-cookies/
[URL Patterns]
http://www.roguewave.com/portals/0/products/hydraexpress/docs/3.5.0/html/rwsfservletug/4-3.html
http://www.c-sharpcorner.com/uploadfile/satyapriyanayak/cookies-servlet-in-java/
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Index Page</title>
</head>
<body>
<form method="POST" action="Validate">
User:
<input type="text" name="user" />
<br /> Password:
<input type="text" name="pass" />
<br />
<input type="submit" value="submit" />
</form>
</body>
</html>
Validate.java
import
import
import
import
import
import
java.io.IOException;
javax.servlet.ServletException;
javax.servlet.http.HttpServlet;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
javax.servlet.http.HttpSession;
}
else
{
}
//Crating a session
HttpSession s=request.getSession();
s.setAttribute("userName", usr);
response.sendRedirect("/SessionManagement/Welcome");
response.getWriter().println("Invalid Credentials!");
}
}
Welcome.java
import
import
import
import
import
import
import
javax.servlet.ServletException;
javax.servlet.http.HttpServlet;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
javax.servlet.http.HttpSession;
java.io.PrintWriter;
java.io.IOException;
Web.xml
========
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>SessionManagement</display-name>
<servlet>
<description></description>
<display-name>Validate</display-name>
<servlet-name>Validate</servlet-name>
<servlet-class>Validate</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Validate</servlet-name>
<url-pattern>/Validate</url-pattern>
</servlet-mapping>
<servlet>
<description></description>
<display-name>Welcome</display-name>
<servlet-name>Welcome</servlet-name>
<servlet-class>Welcome</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Welcome</servlet-name>
<url-pattern>/Welcome</url-pattern>
</servlet-mapping>
</web-app>
[Generating HMTL content inside a Servlet]
import
import
import
import
import
import
import
javax.servlet.ServletException;
javax.servlet.http.HttpServlet;
javax.servlet.http.HttpServletRequest;
javax.servlet.http.HttpServletResponse;
javax.servlet.http.HttpSession;
java.io.PrintWriter;
java.io.IOException;
http://www.codemiles.com/jsp-examples/
[JSTL Examples]
http://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm
http://www.journaldev.com/2064/jsp-expression-language-el-example-tutorial
http://www.javatpoint.com/jstl#core