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



Home Answers Viewqa Java-Beginners servlets deploying
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


prashanthi
servlets deploying
2 Answer(s)      6 years and 7 months ago
Posted in : Java Beginners



Advertisement
View Answers

June 3, 2008 at 6:50 PM


Hi friend,

package javacode;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

public class ServletDeploy extends HttpServlet {
public void doGet( HttpServletRequest request, HttpServletResponse response )
throws IOException, ServletException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Deploy Servlet Example</title>");
out.println("</head>");
out.println("<body>");
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("</table>");
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>");
out.println("</table>");
out.println("<hr>");
Date date = new Date();
out.println("<p align=center>Page generated on "+date);
out.println("</body>");
out.println("</html>");
out.close();

}

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.

<servlet>
<servlet-name>deploy</servlet-name>
<servlet-class>javacode.ServletDeploy</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>deploy</servlet-name>
<url-pattern>/jsp/ServletDeploy</url-pattern>
</servlet-mapping>


---------------------------------

Read for more information.

http://www.roseindia.net/servlets


Thanks

Amardeep


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
DEVELOPING & DEPLOYING A PACKAGED EJB
' 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
Advertisements
servlets
servlets  what is the duties of response object in servlets
servlets
servlets  why we are using servlets
servlets
what are advantages of servlets  what are advantages of servlets   Please visit the following link: Advantages Of Servlets
Servlets
Servlets  How to edit and delete a row from the existing table in servlets
servlets
servlets  How do you communicate between the servlets?   We can communicate between servlets by using RequestDespatcher interface and servlet chaining
servlets
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
Servlets  How to check,whether the user is logged in or not in servlets to disply the home page
servlets
servlets  why we require wrappers in servlets? what are its uses? Please explain   These wrappers classes help you to modify request...://www.roseindia.net/servlets/response-filte.shtml
Servlets
. Anyways, please visit the following links: http://www.roseindia.net/servlets/introductiontoconfigrationservlet.shtml http://www.roseindia.net/servlets
servlets
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
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 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
servlets
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
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
servlets
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
servlets
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...: http://roseindia.net/jsp/jspsession/ http://www.roseindia.net/servlets
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
servlets
regarding the user usage and habits. Servlets sends cookies to the browser client...://www.roseindia.net/jsp/jspcookies.shtml http://www.roseindia.net/servlets/use
servlets
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
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
servlets
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
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
 

 

 

DMCA.com