Series: Servlets general

General discussion on Servlets given indepth like differences, WAR file creation etc.

Servlet WAR File Weblogic Creation Deployment

Servlet WAR File Weblogic Creation, Deployment and Execution is shown step-by-step for a Beginner. With the release of the Java Servlet Specification 2.2, the concept of a Web application was introduced. According to this specification, a "Web Application is a collection of servlets, html pages, classes, and other resources that can be bundled and run …

Servlet WAR File Weblogic Creation Deployment Read More »

getParameterNames() Example Servlets

One of the aspects of Servlets is reading the HTML/Applet data sent by the client like login data etc. For this, three methods exist in ServletRequest interface – getParameter(String), getParameterNames() and getParameterValues(String). These methods are inherited by HttpServletRequest interface. Following are the method signatures as defined in javax.servlet.ServletRequest interface. public java.lang.String getParameter(java.lang.String name): Returns the …

getParameterNames() Example Servlets Read More »

getRequestURL() vs getRequestURI()

getRequestURL() vs getRequestURI() methods are used by Servlet Programmer to retrieve the URL particulars of client. getRequestURL() and getRequestURI() methods are defined in HttpServletRequest interface. These two are used by the Servlet to retrieve the URL information (written in ACTION attribute of FORM tag) used by the client to call the servlet. getRequestURL() vs getRequestURI() …

getRequestURL() vs getRequestURI() Read More »

getServletPath() Method Example

Programmer uses getServletPath() method to retrieve the alias name used by client. getServletPath() Method is defined in ServletRequest inherited by HttpServletRequest. This program uses getServletPath() of HttpServletRequest to retrieve the alias name (of <servlet-mapping>) tag. Client uses this alias name to call the Servlet. Following is the method signature. Method is defined in HttpServletRequest interface. …

getServletPath() Method Example Read More »

getProtocol() Method Example

getProtocol() method is defined in ServletRequest interface from javax.servlet package and inherited by HttpServletRequest. With getProtocol() method, the Servlet Programmer can know what protocol (like HTTP/1.0 or HTTP/1.1) is used by the client from HTML file to call the Servlet. Let us see what Java API says about this method. java.lang.String getProtocol(): Returns the name …

getProtocol() Method Example Read More »

getScheme() Method Example

getScheme() method is defined in ServletRequest interface from javax.servlet package inherited by HttpServletRequest. With getScheme() method, the Servlet Programmer can know what protocol (like HTTP) is used by the client from HTML file to call the Servlet. Let us see what Java API says about this method. public java.lang.String getScheme(): Returns the name of the …

getScheme() Method Example Read More »

getServerPort() Method Example

getServerPort() method is defined in ServletRequest interface from javax.servlet package and inherited by HttpServletRequest. With getServerPort() method, the Servlet Programmer can know what port number is used by the client from HTML file to call the Servlet. Let us see what Java API says about this method. int getServerPort(): Returns the port number to which …

getServerPort() Method Example Read More »

getRemoteAddr() Method Example

getRemoteAddr() method is defined in ServletRequest interface from javax.servlet package inherited by HttpServletRequest. With this method, the servlet programmer can know the IP address of the client from which the request came. Let us see what Java API says about this method. String getRemoteAddr(): Returns the Internet Protocol (IP) address of the client or last …

getRemoteAddr() Method Example Read More »

getRemoteHost() Method Example

This method is defined in ServletRequest interface from javax.servlet package inherited by HttpServletRequest. With this method, the servlet programmer can know the name of the client from which the request came. Let us see what Java API says about this method. java.lang.String getRemoteHost(): Returns the fully qualified name of the client or the last proxy …

getRemoteHost() Method Example Read More »

getRemoteAddr() vs getRemoteHost()

Both getRemoteAddr() vs getRemoteHost() are defined in ServletRequest interface and serves the Servlet Programmer to retrieve the client system particulars from where the request came. They differ slightly in the output. 1. getRemoteAddr() returns a string containing the IP address (in format like IPiv, 127.0.0.1) of the client. 2. getRemoteHost() returns a string containing the …

getRemoteAddr() vs getRemoteHost() Read More »