View All Servlets


    1. Basic Programs

    2. Servlets Introduction, Tutorial, Architecture
    3. First Servlet Step-by-Step Explanation – Login Screen Validation
    4. 7 Steps – Servlets Tomcat Execution
    5. Deployment Descriptor – web.xml
    6. Sending dynamically filled HTML form to client
    7. Sending static HTML form to Client (sendRedirect)
    8. Read all Form data at a time – getParameterNames() Example -I
    9. Read all HTML Form Fields at a time with getParameterNames() Example – II
    10. Read From fields of same name – getParameterValues() Example
    11. Handling the client request – 3 Styles
    12. GET vs POST – 12 Differences – Which to prefer?
    1. Retrieving Client Information with request object

    2. Client’s Browser data with getHeaderNames() and getHeader()
    3. getRequestURL() method Example
    4. getRequestURI() Method Example
    5. Difference between getRequestURL() and getRequestURI()
    6. getRemoteAddr() Method Example
    7. getRemoteHost() Method Example
    8. Difference between getRemoteAddr() and getRemoteHost()
    9. getQueryString() Method Example
    10. getContentLength() Method Example
    11. getServletPath() Method Example
    12. getMethod() Method Example
    13. getProtocol() Method Example
    14. getScheme() Method Example
    15. Difference between getProtocol() and getScheme()
    16. getServerPort() Method Example
    17. isSecure() Method Example
    1. Using response object of HttpServletResponse

    2. sendRedirect Method Example
    3. Alternative to PrintWriter – ServletOutputStream Example – When to prefer?
    1. Servlet Communication

    2. What is ServletConfig interface?
    3. What is ServletContext interface?
    4. Difference between ServletConfig and ServletContext
    5. <init-param> Example with ServletConfig
    6. <context-param> Example with ServletContext
    7. Difference between <init-param> and <context-param>
    8. RequestDispatcher include Example
    9. RequestDispatcher forward Example
    10. 16 differences between include and forward
    11. 20 differences between forward and sendRedirect
    12. Difference between RequestDispatcher from ServletRequest and ServletContext
    1. Session Tracking

    2. HTTP Protocol – Stateless and Connectionless
    3. Session, Session Tracking, Session Management, JSESSIONID
    4. HTTP Session and HttpSession Methods
    5. Session Tracking with HttpSession – Hit Count
    6. Cookie API Methods
    7. Cookies Simple Shopping Cart Example
    8. Life Cycle Tutorial with Life Methods
    9. Life Cycle Example with JDBC
    1. File Handling

    2. Read TEXT file and return contents to Client
    3. Read HTML file and return contents to Client
    1. Status Codes

    2. What is Status code in HTTP Servlets?
    3. Classification of Status Codes in HTTP
    4. List of Status codes – Commonly occurring
    5. What is 404 Not Found Error in Servlets? How to Fix it?
    1. WAR File Creation and Deployment

    2. WAR File creation in Tomcat
    3. WAR File creation in Weblogic
    1. Similarities and Differences

    2. PrintWriter Vs ServletOutputStream
    3. Difference Servlet, GenericServlet, HttpServlet
    4. Difference between ServletRequest, HttpServletRequest
    5. Difference between ServletResponse, HttpServletResponse
    6. Difference between HttpServletRequest and HttpServletResponse?
    1. MISCELLANEOUS

    2. Servlets Made Simple: Learn through Questions/Answers
    3. 15 Advantages of Servlets over CGI and ASP
    4. 10 Advantages of Servlets over ASP
    5. Can we write constructor in Servlet Example?
    6. What is MIME type in Servlets?
    7. More on response.setContentType()
    8. Sending Image to Client
    9. Feedback Form Example – Using all types of Form fields
    10. Multiple Submit Buttons in a single HTML Form
    11. What is SingleThreadModel?
    12. Auto Page Refresh with Servlets setHeader()
    13. ServletContext.getResourceAsStream

9 thoughts on “View All Servlets”

  1. Dear Sir,

    I’m fan of this way2java website. Please let me know is this note available in PDF format as we are staying in hostel. So there is no wifi or net facility.

    Thanks
    Rashmi

  2. Hi sir,

    I have an servlet containing database connection code . I want to read the jdbc connection credential from .properties file.And i have save the file in WEB-INF/classes folder.

    And in servlet i have the code to read the properties file.i.e

    // package custom;

    import javax.servlet.*; import javax.servlet.http.*; import java.io.*;
    import java.sql.*; import java.util.*;

    public class CustomServlet extends HttpServlet
    {
    public void service(HttpServletRequest req, HttpServletResponse res) throws
    ServletException, IOException
    {
    System.out.println(“in service()”);
    res.setContentType(“text/plain”);
    System.out.println(“at line no 14”);

    ObjectInputStream ois = new ObjectInputStream(req.getInputStream( ));
    ObjectOutputStream oos = new ObjectOutputStream(res.getOutputStream( ) );
    res.setContentType(“application/octet-stream”);
    System.out.println(“after application/octet-stream”);// at line 20
    try
    {
    //FileInputStream fis = new FileInputStream(“webapps/ret/WEB-INF/classes/db.properties”);
    FileInputStream fis = new FileInputStream(“db.properties”);
    Properties p = new Properties();
    p.load(fis);
    String dr = p.getProperty(“driver”);
    String cs = p.getProperty(“url”);
    String usr = p.getProperty(“user_name”);
    String pwd = p.getProperty(“pwd”);
    Class.forName(dr);
    Connection con = DriverManager.getConnection(cs,usr,pwd);

    ……………………………….
    ………………..
    ……………………

    The control reaches at line no 20 but it will not reach at this line

    FileInputStream fis = new FileInputStream(“db.properties”);
    ………………..
    ………………….

    i don’t know what is wrong with my code.

    Please help me

    with regards

    bikash

Leave a Comment

Your email address will not be published.