Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa Java-Beginners servlets deploying

Have Programming Question? Ask it here!

servlets deploying
2 Answer(s)      5 years and 11 months ago
Posted in : Java Beginners

View Answers

June 3, 2008 at 6:50 PM

Hi friend,

package javacode;

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

public class ServletDeploy extends HttpServlet {
public void doGet( HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException {
PrintWriter out = response.getWriter();
out.println("<title>Deploy Servlet Example</title>");
out.println("<h3>HTTP Request Header</h3>");
out.println("<table border='1'>");
out.println(" <tr bgcolor=pink>");
out.println(" <td><b>Name</b></td>");
out.println(" <td><b>Value</b></td>");
out.println(" </tr>");
Enumeration e = request.getHeaderNames();
while (e.hasMoreElements()){
String name = (String)e.nextElement();
String value = request.getHeader(name);
out.println(" <tr>");
out.println(" <td bgcolor=pink>"+name+"</td>");
out.println(" <td>"+value+"</td>");
out.println(" </tr>");
out.println("<h3>HTTP Request Information</h3>");
out.println("<table border='1'>");
out.println(" <tr bgcolor=pink>");
out.println(" <td><b>Name</b></td>");
out.println(" <td><b>Value</b></td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td bgcolor=pink>Method:</td>");
out.println(" <td>"+request.getMethod()+"</td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td bgcolor=pink>Request URI:</td>");
out.println(" <td>"+request.getRequestURI()+"</td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td bgcolor=pink>Protocol:</td>");
out.println(" <td>"+request.getProtocol()+"</td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td bgcolor=pink>PathInfo:</td>");
out.println(" <td>"+request.getPathInfo()+"</td>");
out.println(" </tr>");
out.println(" <tr>");
out.println(" <td bgcolor=pink>Remote Address:</td>");
out.println(" <td>"+request.getRemoteAddr()+"</td>");
out.println(" </tr>");
Date date = new Date();
out.println("<p align=center>Page generated on "+date);


public void doPost( HttpServletRequest req, HttpServletResponse res)
throws IOException, ServletException{
doGet(req, res);

June 3, 2008 at 6:54 PM

This is servlets mapping code.



Read for more information.



Related Tutorials/Questions & Answers:
servlets deploying - Java Beginners
servlets deploying  how to deploy the servlets using tomcat?can you please explain the total deploying and executing process?  Hi friend...); } } -------------------------------------------------------  This is servlets
' is very important in Enterprise Java. Compiling and Deploying such packaged servlets... and deploying Servlets with or without package and beans, along with JSP... DEVELOPING & DEPLOYING A PACKAGED EJB (WEBLOGIC-7) & ACCESSING
servlets  what is the duties of response object in servlets
servlets  why we are using servlets
what are advantages of servlets  what are advantages of servlets   Please visit the following link: Advantages Of Servlets
Servlets  How to edit and delete a row from the existing table in servlets
servlets  How do you communicate between the servlets?   We can communicate between servlets by using RequestDespatcher interface and servlet chaining
what is the architecture of a servlets package  what is the architecture of a servlets package   The javax.servlet package provides interfaces and classes for writing servlets. The Servlet Interface The central
Servlets  How to check,whether the user is logged in or not in servlets to disply the home page
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request...://
. Anyways, please visit the following links:
servlets  How to open and read the contents of a text file in servlets?   Please visit the following link: Read text file using Servlet
servlets   Hi what is pre initialized servlets, how can we achives?   When servlet container is loaded, all the servlets defined in the web.xml file does not initialized by default. But the container receives
servlets why do we need web-inf directory in web application  why do we need web-inf directory in web application? means what's the benefits of doing so
Servlets and
Servlets and   Sir...! I want to insert or delete records form oracle based on the value of confirm box can you please give me the idea.... thanks
which are the differ ways you can communicat between servlets  which are the differ ways you can communicat between servlets   Different ways of communicating between servlets:- 1)Using RequestDispatcher object. 2
what are sessions in servlets  what are sessions in servlets   A Session refers to all the request that a single client makes to a server...:
package supports the development of servlets that use the HTTP protocol. The classes... javax.servlet.GenericServlet and serves as the base class for HTTP servlets. HttpServlet-Request
the servlets
what is diff between generic servlets and httpservlets  what is diff between generic servlets and httpservlets   Difference between GenericServlet and HTTPServlet: 1)GenericServlet belongs to javax.servlet package
regarding the user usage and habits. Servlets sends cookies to the browser client...://
servlets  hi i am using servlets i have a problem in doing an application. in my application i have html form, in which i have to insert on date value, this date value is retrieved as a request parameter in my servlet
servlets  what are different authentication options available in servlets   There are four ways of authentication:- HTTP basic authentication HTTP digest authentication HTTPS client authentication Form-based
what are filters in java servlets  what are filters in java   Filters are powerful tools in servlet environment. Filters add certain functionality to the servlets apart from processing request and response paradigm
Upload Code error on deploying
Upload Code error on deploying  on deploying the above code as it is said it is giving error that " No getter method for property thefile of bean org.apache.struts.taglib.html.BEAN " Error 500--Internal Server Error
Running and deploying Tomcat Server
Running and deploying Tomcat Server  HI Somebody has given the solution but it doesn't work out. kindly tell the solution for my problem which i described below I want to run a simple program on servlet and the application
Deploying Servlet in Weblogic 9.2 - Servlet Interview Questions
Deploying Servlet in Weblogic 9.2  Hi Friends, I am new to web application, can u explain briefly wat is "Deploying a .war,.jar,.ear files in target server. I am using Struts framework,servlets and hibernate.Jsp for page
Deploying website war file on linux
Deploying website war file on linux  I have BOLLYWOOD_MIRROR.war file.I want to host it on linux server on path. After deployment of war file its reflecting 404 error while it is proper working locally. I need step by step
Deploying and testing Stateless Session Bean
Deploying and testing Stateless Session Bean       ...; </project> Deploying
Deploying Servlet in Weblogic 9.2 - Servlet Interview Questions
Deploying Servlet in Weblogic 9.2   Hi Friend thanks in advance, can u give me steps for deploying servlet using weblogic server 9.2
jsp -servlets
jsp -servlets  i have servlets s1 in this servlets i have created emplooyee object, other servlets is s2, then how can we find employee information in s2 servlets
Deploying Weblogic Server in MyEclipseBlue6.6 - IDE Questions
Deploying Weblogic Server in MyEclipseBlue6.6  Hi I am facing some problem in deploying "weblogicserver8.1" in my "MyEclipseBlue6.6".Please provide me detailed path of BEA home directory, Web logic Installation directory
Wats Deploying war in Target Server - Development process
Wats Deploying war in Target Server   Hi Friends, I am new to web application, can u explain briefly wat is "Deploying a .war,.jar,.ear files in target server. Thank u in advance   Hi rajendra
Servlets with Extjs
Servlets with Extjs  how to integrate servlets and extjs and also show database records in extjs grid using servlet how to get servlets json response. Can any one please help me
Authentication in Servlets
Authentication in Servlets  What are different Authentication options available in Servlets
advantages of Servlets
advantages of Servlets  What is advantages of Servlets ?    Portability. Powerful. Efficiency. Safety. Integration. Extensibilty. Inexpensive
java servlets
java servlets  please help... how to connect java servlets with mysql i am using apache tomcat 5.5
servlets and struts
servlets and struts  wat is the diffrence between servlets and struts?   A Servlet is a technology and Struts is a framework which relies on or makes use of Servlets.A Servlet is a controller. Struts has its own Servlet
Servlets Programming
Servlets Programming  Hi this is tanu, This is a code for knowing... visit the following links: http
Issue when deploying mdb jar in weblogic
Issue when deploying mdb jar in weblogic  Hi, I have written the code to read messages from queue.But when i deploy this in weblogic 9.2 after creating a jar file it is showing unmarshaller failed Below is the code
Sessions in servlets
Sessions in servlets  What is the use of sessions in servlets?   The servlet HttpSession interface is used to simulate the concept that a person's visit to a Web site is one continuous series of interactions
Error with Maven while deploying the war file
Error with Maven while deploying the war file  Hi, I am new to maven... I created java spring hibernate project.. and i kept all .java files in this path Myapplication\src\main\java\com\mycompany and create resources, webapp