Where to place HTMl files in  tomcat while executing Servlets examples ?

Hi,
I'm learning servelets (HttpServlets). in that input is given through html files.now i dont know where to place that html file in apache tomcat server
This is my Directry Structure
Java's ---- C:\Program Files\Java\jdk1.5.0\bin
Tomcat's--C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class ThreeParams extends HttpServlet
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException, IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
String docType ="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +"Transitional//EN\">\n";
out.println(docType +"<HTML>\n" +"<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +"<BODY BGCOLOR=\"#FDF5E6\">\n" +"<H1 ALIGN=\"CENTER\">" + title + "</H1>\n" +"<UL>\n" +" <LI><B>param1</B>: "+ request.getParameter("param1") + "\n" +" <LI><B>param2</B>: "+ request.getParameter("param2") + "\n" +" <LI><B>param3</B>: "+ request.getParameter("param3") + "\n" +"</UL>\n" +"</BODY></HTML>");
}HTML code ---
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Collecting Three Parameters</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<H1 ALIGN="CENTER">Collecting Three Parameters</H1>
<FORM ACTION="ACTION="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\root\WEB-INF\classes.ThreeParams">
First Parameter: <INPUT TYPE="TEXT" NAME="param1"><BR>
Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
<CENTER><INPUT TYPE="SUBMIT"></CENTER>
</FORM>
</BODY></HTML>
{code}
servlet code is compiling without any errors, now where should i place the class file and html file in tomcat to execute this program..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

webapps\yourapplicationname\WEB-INF\

Similar Messages

  • Deploying Servlet with HTML file on Tomcat

    Hi ,
    I created a servlet and an html file. The html file accepts user data and passes it to servlet.
    I want to deploy these two files using Tomcat server. Please tell me a sure procedure for deploying both files.
    Regards,
    ap.

    First of all its better to make a jsp rather than one HTML and a servlet but anyhow in order to deploy it first build your project and create a war file which should contain your HTML and servlet and the web.xml.
    Then place this war file inside the webapps folder of tomcat.Start the tomcat and hit your HTML on the browser....

  • Accordion Panels and List Menu don't work if I place html files in subfolders

    Hi all,
    Switched from Dreamweaver to Muse and I have very limited knowledge of code.
    Not an IT expert and not a web developer this is just for my own site.
    I have sub-folders in my site. All html files are inside sub-folders except index.
    ie contact.html or products.html I move them manually from root to the subfolder, using the easy interface of Dreamweaver. I call the subfolder "en"
    so I can have pages such as mysite.com/en/contact.html
    In the subfolder I copy and paste from  root the css, images and script folders,
    keeping the original css/images/scripts as well, in the root, so index.html is not affected.
    and same time the look of the html pages inside the subfolders does not change.
    BUT
    list menus and accordion panels don't work. I click and there is no movement
    How can I solve this ? I know Muse does not allow the creation of subfolders,
    everything is uploaded in the root.
    When in Dreamweaver I had placed 50 pages in subfolders and I was indexing them in google and bing.
    Now can't again put 50 pages in root and can't remove URLs and make new indexing for all these pages
    Any help ? many thanks for any assistance.

    The iPhone, like the Ipad, uses the Mobile Safari browser, so here's an earlier thread that might give you some insight: http://forums.adobe.com/thread/613494

  • Where to place .ini file?

    Hello All,
    I have a file "trap.ini"
    now where i should this file so that
    properties.load(new FileInputStream("trap.ini")); should be able to read it.
    m i making any mistake?

    my trap.ini is at location C:\trap\config\trap.ini
    and this is included in my classpath...
    still its giving me error... I am using JBOSS as application server.. I am running my servlet on JBOSS and my servlet needs to read "trap.ini"
    is thr any way in which i can provide that file to JBOSS server in eclipse..?
    Thank you for helping me

  • Error while executing Java examples

    Hello every 1,
    Whenever I try to compile the java code using commandline, i am getting the same kind of error. Can some one please help me if there is a trick on executing these examples. For instance I compiled this java example given here . compilation is successful. When I try to execute the program, I get the error message, could not find or load mainclass ArrayDemo.
    Appreciate your help.
    Thanks,
    FJ

    Hi -
    When I compile the program using command prompt, I am in C:\Users\Farooq\MyPrograms directory. MyPrograms is where all my programs are.
    Below is the actual program, it does not have package statement.
    class ArrayDemo {
    public static void main(String[] args) {
         int[] anArray; // declares an array of integers
    anArray = new int[10]; // allocates memory for 10 integers
    anArray[0] = 100; // initialize first element
    anArray[1] = 200; // initialize second element
    anArray[2] = 300; // etc.
    anArray[3] = 400;
    anArray[4] = 500;
    anArray[5] = 600;
    anArray[6] = 700;
    anArray[7] = 800;
    anArray[8] = 900;
    anArray[9] = 1000;
    System.out.println("Element at index 0: " + anArray[0]);
    System.out.println("Element at index 1: " + anArray[1]);
    System.out.println("Element at index 2: " + anArray[2]);
    System.out.println("Element at index 3: " + anArray[3]);
    System.out.println("Element at index 4: " + anArray[4]);
    System.out.println("Element at index 5: " + anArray[5]);
    System.out.println("Element at index 6: " + anArray[6]);
    System.out.println("Element at index 7: " + anArray[7]);
    System.out.println("Element at index 8: " + anArray[8]);
    System.out.println("Element at index 9: " + anArray[9]);
    }

  • Invoke .html file in tomcat 4

    I am newbie to servlet and I am trying some simple example of servlet in
    which I have written
    1) a html form to get data saved in webapps/myplace/
    2) a servlet which is to return the data got from the request.get of the
    html form.
    I have deployed the tomcat server, put the compiled servlet class in the
    WEB-INF/classes and also make the web.xml file.
    However, when I load the page to the servlet from the html form, and click
    submit from the form which is supposed to link to the servlet, it returns
    404 error which said it cannot load the page.
    I would like to know what I have missed that lead to such problem.
    Thousands Thanks

    do you have the URLs right, are there any port numbers that needed to be included ?
    i.e. http:\\www.mywebserver:1234\MyWebPages

  • Where to place    text file in  Jdeveloper9irc  to read from Java program

    For ex.
    package mypackage;
    import java.io.*;
    public class ReadData
    public ReadData()
    public static void main(String[] args)
    new ReadData();
    try{
    File fin = new File("test.txt");
    if (fin.canRead())
    System.out.println("Can read file");
    I am geting a error message of file not found. Please advise
    in which directory should I place the text file "test.txt" so that the java program can read from it.
    Thanks,
    agsp

    The test.txt file should be in the 'Run Directory" of your Project. Select Project.jpr and invoke Project settings dialog.
    Click on the Runner. You will see the "Run Directory" edit field.
    For ex.
    package mypackage;
    import java.io.*;
    public class ReadData
    public ReadData()
    public static void main(String[] args)
    new ReadData();
    try{
    File fin = new File("test.txt");
    if (fin.canRead())
    System.out.println("Can read file");
    I am geting a error message of file not found. Please advise
    in which directory should I place the text file "test.txt" so that the java program can read from it.
    Thanks,
    agsp

  • Where to place lib files so my task adapter can find it?

    I am currently getting the error": java.lang.NoClassDefFoundError:". I would like to add my lib files so my java adapter code can find it. Thanks

    If they are jar files that wont ever change, you can put them in your ThirdParty folder and use the upload jar utility. If that doesn't work, you will need to add them to your oim server startup parameters so it knows about the jar.
    -Kevin

  • How to attach a file to tomcat server using SERVLETS

    Hello friends,
    I want to enable users to attach a file and send it to my server. This is a very common feature seen anywhere like e-mail attachments.
    Iam using tomcat server. I tried HTTP put but it did not work.
    Please give some suggessions.
    Thanks
    Goldy

    check this url:
    http://www.servlets.com/cos/index.html
    follow the link MultiPartRequest
    Spieler

  • Error while executing Servlet. java.lang. (Error in loading Specific Driver

    Hi all,
    I am getting the following error while running the servlet.
    Error:
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver,
    The above error arise while I try to access a data from the database table using servlet through browser, but the same driver works well in jdbc program(jdbc alone).
    Here is how I am load the driver:
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    con=DriverManager.getConnection("jdbc:microsoft:sqlserver://NODE1:1433","**","**");
    con.setCatalog("senthil");
    Here is my software specification:
    Tomcat5.5.26,
    MS SQL Server 2000 Driver.
    Looking forward to your reply,
    Thanks in advance,
    Senthil.

    Hi,
    Thanks for your reply.
    Yes, I am using the Eclipse IDE, and it doesn't shows any error while I save the servlet source file.
    Please find the below source code:
    *1. JDBC program to retrive data from the database table: No issue works well.*
    The below source code works well and I used it to retrive the data from the database table using the jdbc.Here there is no problem, the source code works well.
    package pak;
    import java.sql.*;
    import java.io.*;
    class UserDataDemo
         public static void main(String args[])
              Connection con;
              ResultSet result;
              try
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   con=DriverManager.getConnection("jdbc:microsoft:sqlserver://NODE1:1433","user_name","password");
                   con.setCatalog("datadase_name");
                   Statement stat=con.createStatement();
                   result=stat.executeQuery("select * from table_name");
                   while(result.next())
                        System.out.println("**************************************");
                        System.out.println("Name :"+result.getString(1));
                        System.out.println("Company :"+result.getString(2));
                        System.out.println("Position:"+result.getString(3));
                        System.out.println("Emp Id :"+result.getInt(4));
                        System.out.println("Place :"+result.getString(5));
              catch(Exception e)
                   System.out.println(e);
    *2.Issue: Servlet program used to retrive data from the data base table through jdbc:*
    Here I am getting above said error : java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    Please note, here I dosen't get any compile time error(i.e, eclipse ide doesn't shows any error while saving this file).
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class ServletTest extends HttpServlet
         String name;
         ResultSet result;
         PrintWriter pw;
         public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
              Connection con;
              try
                   res.setContentType("text/html");
                   pw=res.getWriter();
                   Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                   con=DriverManager.getConnection("jdbc:microsoft:sqlserver://NODE1:1433","user_name","password");
                   con.setCatalog("database_name");
                   Statement stat=con.createStatement();
                   result=stat.executeQuery("select * from table_name");
                   while(result.next())
                        pw.println(result.getString(1));
              catch(Exception e)
                   pw.println(e);
    Also please note, I have no problem in running the servlet alone.
    Looking forward to your reply,
    Thanks,
    Senthil.

  • Error while executing servlet through a HyperLink.

    Hi
    When i am trying to execute a servlet through the HyperLink using this statement
    where CallStatusDetailsAssign is my servlet.then i am getting this error :
    The Following is the Alert Message.
    1. Microsoft InterNet Explorer
    http://localhost:8080/examples/servlets/CallStatusDetails?Call_ID=1&EMP_NO=1
    ** Download of the specified Resource has failed.
    & also getting this error:
    2. IE Cannot open the Internet Site
         ** Operation has been Cancelled.
    If i refresh the screen by clicking on refresh button in the Internet Explorer.the Page is getting displayed properly.
    Is there any problem with my servlet code ??or some other Problem.
    Can Anyone Please help me on this & give me the Solution for my Problem.
    Rashmi

    I'm not sure if this is cause of your problem but the anchor tag should look like this:
    some text</ a>
    ... in the code the quotes are missing
    spieler

  • Error while executing Servlet.

    Hi all,
    I am getting the following error while running the servlet.
    Error:
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver,
    The above error arise while I try to access a data from the database table using servlet through browser, but the same driver works well in jdbc program(jdbc alone).
    Here is how I am load the driver:
    Class.+forName+("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    con=DriverManager.+getConnection+("jdbc:microsoft:sqlserver://NODE1:1433","**","**");
    con.setCatalog("senthil");
    Here is my software specification:
    Tomcat5.5.26,
    MS SQL Server 2000 Driver.
    Looking forward to your reply,
    Thanks in advance,
    Senthil.

    Hi all,
    This is an corrcted version of the above topic. Please find the correction in the Driver connection,
    Class.forName('com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Connection con=DriverManager.getConnection("jdbc:microsoft:sqlserver://NODE1:1433","**","**");
    con.setCatalog("senthil");
    Thanks,
    Senthil.
    Edited by: SenthilJansi on Mar 21, 2008 10:36 PM

  • "BAD packet signature 18245" :error while executing servlet

    i am running a servlet under jakarta-tomcat-4.1.24...the server is crashing giving the error "BAD packet signature 18245",unable to process header ..help me out plzz,,

    Hi, I have the same problem and yes I'm running mod_jk on apache. Anybody knows the solution?
    Our problem is that we have a load balancing solution for webservices (axis), using mod_jk, which works for lets say about 5 hours after that the services become unavailable (wsdl still reachanble by the browser, but unreachable/unusable form the applications using teh webservices).
    Sometimes the tomcat crashes and this Exception appears in its logs.
    Thanks for any help in advance.

  • FILENOTFOUNDEXCEPTION while reading property files in Tomcat 6------Help me

    Hi All
    I am planning to migrate my web application from iplanet 4.1 to tomcat 6. In this process I need to read the properties files initially.
    for eg: i got the property files in a iPlanet:
    Config directory---
    abc.properties.---
    abc.log--
    In tomcat I configured them in web.xml saying that.
    <servlet>
    <servlet-name>ABC</servlet-name>
    <servlet-class>com.ijk.abc</servlet-class>
    <init-param>
    <param-name>Loan</param-name>
    <param-value>/WEB-INF/config</param-value>
    </init-param>
    <init-param>
    <param-name>loan.props</param-name>
    <param-value>/WEB-INF/config/abc.props</param-value>
    </init-param>
    <init-param>
    <param-name>loan.log</param-name>
    <param-value>/WEB-INF/config/abc.log</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>ABC</servlet-name>
    <url-pattern>/</url-pattern>
    </servlet-mapping>
    I need to read initially all the property files and then proceed.
    While configuring in this way, it am getting error saying that
    abc.props or abc.log..............(FILE NOT FOUND EXCEPTION)
    Can anyone suggest me how to configure them.
    Thanks in Advance.

    Thanks for your response, Actually we dont have the source code for that because it is very old code, but i m using decompiler in which i can get some informtaion.
    OS used for iPlanet is Unix but now I need to deploy this application in tomcat in windows server 2003.
    Servlet clss:
    SERVLET CLASS:
    Class com.ijk.abc implements extends HttpServlet  implements PropertyKeys
    private IClickManager m_im;
    public void init(ServletConfig paramServletConfig)
        throws ServletException
        Utils.info("Servlet initialization");
        try {
          super.init(paramServletConfig);
          Utils.info("ServerInfo: " + getServletContext().getServerInfo());
          PGroup localPGroup = this.m_im.claimPG();
          Utils.trace("Got " + localProcessorGroup + " for initialization");
          this.m_im.gatherProperties(localProcessorGroup);-----------this is where it is calling the property files.
          this.m_im.freePG(localPGroup);
          Utils.trace("Released " + localPGroup + " for new Properties");
          localPGroup = this.m_im.claimPG();
          Utils.trace("Got " + localPGroup + " for new Properties");
          try
            ConHandler localDBHandler = (ConHandler)localPGroup.getDBHandler("config.dbhandler");
            this.m_im.setNumPGs(localDBHandler.getNumPGroups());
          catch (Exception localException1) {
            Utils.info("NON FATAL ERROR: failed to set number of PGs", localException1);
          try
            Session.createAndStartSessionTask(localPGroup);
            localPGroup.resumeAllTasks();
          catch (Exception localException2) {
            Utils.info("NON FATAL ERROR: failed to start tasks", localException2);
          this.m_im.freePG(localPGroup);
          Utils.trace("Released " + localPGroup + " for initialization");
          Utils.info("Servlet initialization finished");
        catch (FatalServletError localFatalServletError) {
          Utils.error("FatalServletError: ", localFatalServletError);
          throw new UnavailableException(this, localFatalServletError.toString());
        catch (Error localError) {
          Utils.error("Error: ", localError);
          throw localError;
    ==========================================================
    public void gatherProperties(ProcessorGroup paramProcessorGroup)
        Object localObject;
        this.m_props.clear();
        String str1 = this.m_servlet.getInitParameter("loan.dir");
        if (str1 == null) {
          str1 = System.getProperty("server.root", System.getProperty("user.dir", "."));
        this.m_props.put("loan.dir", str1);
        String str2 = this.m_servlet.getInitParameter("abc.log");
        setLogFile(str2);
        try
          String str3 = this.m_servlet.getInitParameter("abc.props");
          if (str3 == null)
            str3 = "abc.props";
          localObject = str1 + File.separator + str3;
          Utils.info("Reading properties from file: " + ((String)localObject));
          Utils.loadProperties(this.m_props, new BufferedInputStream(new FileInputStream((String)localObject)));
        catch (IOException localIOException) {
          Utils.info("NON FATAL WARNING: Could not read props file", localIOException);--while running i m getting this error
        Utils.info("Reading properties from Servlet Parameters");
        Enumeration localEnumeration = this.m_servlet.getInitParameterNames();
        while (localEnumeration.hasMoreElements()) {
          localObject = (String)localEnumeration.nextElement();
          this.m_props.put(localObject, this.m_servlet.getInitParameter((String)localObject));
        Utils.info("Reading properties from DB");
        try {
          localObject = (ConDBHandler)paramProcessorGroup.getDBHandler("config.dbhandler");
          String str5 = ((ConDBHandler)localObject).getPropertiesFile();
          Utils.loadProperties(this.m_props, new ByteArrayInputStream(str5.getBytes()));
        catch (Exception localException) {
          Utils.info("NON FATAL WARNING: Could not read props file", localIOException);--while running i m getting this error
        String str4 = this.m_props.getProperty("smtp.host");
        if (str4 != null) MailUtils.setSMTPHost(str4.trim());
        if (str2 == null) {
          str2 = this.m_props.getProperty("abc.log");
          setLogFile(str2);
         runInitializers(paramPGroup);
        Utils.info("New Properties:", this.m_props);
        this.m_rroots = StringUtils.getPathsFromList(this.m_props.getProperty("resource.path", "/com/loan/resources/:/"));
        clearAllPGs();
    =================================================================
    the above is the servlet class and the method which is using to read the property files from root directory in Unix.
    ie../opt/mywebapp/loan/abc.props,abc.log
    loan is the directory in which two property files are placed.
    i just want to where to place property files in tomcat so that its going to read the property files.
    Right now, i placing it in the WEBAPPS/MYWEBAPPLICATION/WEB-INF/LOAN/abc.props,abc.logs.
    Its giving me errors such as FILENOTFOUNDEXCEPTION or cannot read the property files.
    The main problem is ...I donot have the complete source code. while decompiling i m not able view complete source code.
    Please help me regarding this.........
    Thanks in advance.

  • How to place a servlet file in Tomcat 5.0?

    Hi,
    i'm using Apache Tomcat 5.0 as myweb server.i don't know how to set the class path and where to place my servlet and html files,and how to run my servlet file.if anybody knows plz give me a detailed description abt this topic.

    Look at the directory structure of your Tomcat installation directory. You will see a webapps directory under that. The Tomcat installation comes with samples ready to run. Look at those and create a similar directory structure under webapps for your application. I don't think you need to worry about classpath. Tomcat should be taking care of all that if you create the proper directory structure.
    You run your servlet by specifying a url like:
    localhost:8080/servlets-examples/from a browser. This assumes that your installation is using port 8080 which I think is the norm for Tomcat. Here "servlets-examples" is the name of the directory you created. Actually Tomcat 5.0 comes with a "servlets-examples" application. This would be a good directory to look at. You could also run their examples to get a feel for it.
    If you are new to servlets, you'll probably have to get a book that explains how things need to be set up. You'll need to create a web.xml for your application. If you look at the servlets-examples directory under webapps, you'll see that it has a WEB-INF directory under it and that directory contains a file called web.xml as well as a sub-directory called classes. This structure is standard accross all application servers because it corresponds to the war (wars are specialized types of jars for web apps) file standard.

Maybe you are looking for

  • Is there a way to deselect all of the music in iTunes at one time?

    Is there a way to deselct all of the music in iTunes at one time?  I tried the Select All choice but didn't see anything after that.

  • 10 key not working in bootcamp on windows 7

    Just finished loading bootcamp / Win 7 on Lion and the apple usb extended keyboard has no function on the 10 key pad. Cant find any Windows settings to activate it. Is there a special driver or something thats needed?

  • Leasing of Assets

    Hi I wanted to know how leasing are handled in FI (Assets Accounting) module. There is one tab in asset master for lease assets Here i have both the scenarios: Assets taken on lease and assets given on lease. Please let me know how these scenarios is

  • Error on FTApp.java

    hello i have a file FTApp.java and i tried to compile it and get many errors ( about 70) which i got it from atinav group and they ensure that it works ,,, in fact ,,, i think kost errors comes because it can`t see classes from packages like javax.bl

  • SOAP Data source Function module table structure different from Dev to QA

    Hi All, I have generated SOAP data source in BWD and it created a ZOXBWD0117 structure and I am using this structure for XI proxy. But when I generate the same SOAP data source in BWQ, a different structure is created ZOXPBW0110. Because of the struc