How to setup web.xml files in Tomcat 4.0.6

Hi, I'm to new to Java Servlets. i am trying to run my first servlet but it's not showing up..can anyone help me out please!!!
I created a folders like this:
webapps/sumitapps/WEB-INF\classes\Forms\login.class
under sumitapps: i'm puttin all of my .html files(Logins.html)
under WEB-INF: i put web.xml file and classes folder
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>login</servlet-name>
<servlet-class>Forms.login</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>login</servlet-name>
<url-pattern>/Forms.login</url-pattern>
</servlet-mapping>
</web-app>
<Context path="/sumitapps" docBase="webapps/sumitapps" crossContext="true" debug="0" reloadable="true" trusted="false" >
</Context>
under my classes folder i put folder Forms where i'm keeping all of my .class files. my class file name is login.class
can anyone tell me why i cant run my servlets
<FORM method="POST" action="Forms.login"
name=userinfo onsubmit="return checkData()">
please help me out here
i can access my html page like this:
http://lcoalhost:8080/sumitapps/Logins.html
but when i enter userid and password it doesnt show anything..it takes me to http://localhost:8080/sumitapps/Forms.login
and shows cannot be displayed

have a look at www.moreservlets.com. There you can find a free pdf (part of the book, a whole chapter) that explains in deep the use of web.xml.

Similar Messages

  • Automate creation of web.xml file for tomcat 4.1.29

    hi , this is with ref to Tomcat 4.1.29, if i am correct, each Servlet in the application has to be mentioned in the web.xml file for the Tomcat to know about it. Is there any way to automate the creation of web.xml file , depending on the contents of the Servlet folder of the application. Any way to escape from writing each Servlet name in web.xml file.
    rc

    Hello,
    Maybe you should check if you can use Ant tool to do
    that. I am not sure if it can help u.
    Zeph.
    http://ant.apache.org/
    It will, specially if used in conjunction with XDoclets :
    http://xdoclet.sourceforge.net/
    XDoclet has Ant tasks to generate web.xml files.

  • Where is the web.xml file in Tomcat 5.5

    hi folks,
    i made a small appl in Tomcat 5.5 named "Name". I made a WEB-INF folder inside the Name folder (which obv is inside the webapps folder), which inside had the classes and lib folder. After running the application where do i look for the web.xml file controlling my appl?
    thanx in advance..

    well, the web.xml file must be done for you. Its specific to your project, you wont find in on other folders of tomcat.

  • How to get Context paramters out of Tomcat web.xml file

    The Documentation at Tomcat seems to suggest:
    Context initialization parameters that define shared
    String constants used within your application, which
    can be customized by the system administrator who is
    installing your application. The values actually
    assigned to these parameters can be retrieved in a
    servlet or JSP page by calling:
    String value =
    getServletContext().getInitParameter("name");
    Now I want to write a jsp, where the user enters his username and pwd, and this contacts a jdbc connection bean. I want to store the driver name in the web.xml file. Now can some1 please suggest a method as to how I can extract this (It ain't that straightforward as suggested in tomcat doumntation. You cannnot call the above method ithout Servlet Initialization (actually to say ithout HTTP Connection). I succeeded when I had written a servlet, but can some1 please suggest an alternative (bcoz othrwise just to extract that I am writing a servlet).
    Hope I am clear.
    Thanks in advance.

    Edit your web.xml file and add these entries,
    <context-param>
    <param-name>dbUrl</param-name>
    <param-value>jdbc:oracle:thin:@server5:1521:pl2java</param-value>
    </context-param>
    <context-param>
    <param-name>dbDriver</param-name>
    <param-value>oracle.jdbc.driver.OracleDriver</param-value>
    </context-param>
    Place the above entries in between your already existing <web-app> and </web-app> tags.
    Now in your jsp, you can use, <% application.getInitParameter(); %> and in servlet, getServletContext().getInitParameter();
    Hope this helps.
    Sudha

  • Web.xml file problem in tomcat

    Hi i need help in this... its urgent
    currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
    The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
    To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
    www root directory or webapps:/var/www/htm
    Classes directory located in: /var/www/html/WEB-INF/Classes/
    There you will need to upload your Java class file.
    Our default url-mapping for servlet is: /servlet/*
    To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
    Jsp Files - Upload anywhere in /var/www/html
    all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
    pls help its urgent!!!

    first sorry about cross posting the subject. i didnt know i am not suppose to do that. i post in a few forums that are related to my topic. sorry
    The tomcat on the web server is of version Private J2EE / Tomcat 4.1.29 and the standalone tomcat i am using is also tomcat 4.1
    the web.xml in my standalone server in root/web-inf/ is as follows and it is configure for authentication purposes. It works together with the tomcat-users.xml located on conf directory
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
    <web-app>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>
    Restricted Area
    </web-resource-name>
    <url-pattern>/secure/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>manager</role-name>
    <role-name>tomcat</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.html</form-login-page>
    <form-error-page>/Error.html</form-error-page>
    </form-login-config>
    </login-config>
         <security-role>
         <description>The Secure ROLE</description>
         <role-name>manager</role-name>
              <role-name>tomcat</role-name>
         </security-role>
    <security-constraint>
    <web-resource-collection>
    <web-resource-name>
    Restricted Area
    </web-resource-name>
    <url-pattern>/Customer/*</url-pattern>
    </web-resource-collection>
    <auth-constraint>
    <role-name>customer</role-name>
    <role-name>tomcat</role-name>
    </auth-constraint>
    </security-constraint>
    <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
    <form-login-page>/Login.html</form-login-page>
    <form-error-page>/Error.html</form-error-page>
    </form-login-config>
    </login-config>
         <security-role>
         <description>The Secure ROLE</description>
         <role-name>customer</role-name>
              <role-name>tomcat</role-name>
         </security-role>
    </web-app>
    using this web.xml, my stanalone web pages works fine for all servlets and jsp. however if i copy this over to the web server, i still cannot load my servlets and jsp. moreover it doesnt work for authentication purpose anymore. i don't know why too
    i have try the codes you write before and it also doesnt work
    the problem is i cannot get the support form the web hosting site. This is the link that suppose to teach me but it doesn not tell me how to configure my web.xml
    https://www.eroute.net/JSPSupport.htm

  • How to config the web.xml file, when I use Richfaces + RI 1.2?

    Hi there:
    I want to use Richfaces + RI 1.2 to build a project. I don`t know how to config the web.xml file.
    By the way, my web server is Tomcat 6.0, my JDK's version is 6u6. I don`t want to use the facelets.
    thanks.
    lxm

    just add this before *</web-app>*
    <context-param>
           <param-name>org.richfaces.SKIN</param-name>
           <param-value>blueSky</param-value>
      </context-param>
      <filter>
           <display-name>RichFaces Filter</display-name>
           <filter-name>richfaces</filter-name>
           <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>
      <filter-mapping>
           <filter-name>richfaces</filter-name>
           <servlet-name>Faces Servlet</servlet-name>
           <dispatcher>REQUEST</dispatcher>
           <dispatcher>FORWARD</dispatcher>
           <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>

  • JSF - How to set up tag libs in web.xml file?

    Hello all,
    I have a doubt... that in an JSF application we are using two tag libraries, one for the core and other for html components. Both these *.tld files are jared inside "jsf-impl.jar" file.
    The problem is that when i start the web server (Tomcat4.0.6) the console shows that taglib tag must be configured... this means that we have to specify the "<taglib></taglib>" elements in the web.xml file of the jsf application... but how do configure the jar file...
    please guide...

    Putting the JAR files in WEB-INF/lib and using the standard URIs in the taglib directives are all that's needed; the container locates the TLDs in the JAR files at startup.
    If this doesn't work, it's a bug in the container. You may want to upgrade to a later version of Tomcat; 4.0.6 is ancient, and may very well be buggy in this area.

  • How to configure a JNDI ressource in the web.xml file

    Hi,
    does someone know if there is a way to configure a JNDI ressource with its parameters only in the web.xml file ?
    In my case, the JNDI ressouce is an oracle database an its conenction paramters: driverClassName, username, password, etc...
    Actually, I put everything in the configuration file of Tomcat but I would like my war file to be 100% independent of the application server.
    Thanks in advance.
    Fred.

    I wrestled with this for a long time. I may have done something wrong, but to get my mySQL JDNI reference to work, I had to add it to the server.xml file. You can try with web.xml, but I eventually just got frustrated and put it in server.xml.
    The following is between two <context> tags:
    <Resource name="jdbc/instance_name_goes_here"
                   auth="Container"
                   type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/same_instance_name_here">
                   <parameter>
                        <name>username</name>
                        <value>user_name_goes_here</value>
                   </parameter>
                   <parameter>
                        <name>password</name>
                        <value>password_goes_here</value>
                   </parameter>
                   <parameter>
                        <name>driverClassName</name>
                        <value>jdbc_fully_qualified_class_name</value>
                   </parameter>
                   <parameter>
                        <name>factory</name>
                        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                   </parameter>
                   <parameter>
                        <name>url</name>
                        <value>jdbc_connect_url_database_vendor_specific</value>
                   </parameter>
                   <parameter>
                        <name>maxActive</name>
                        <value>8</value>
                   </parameter>
                   <parameter>
                        <name>maxIdle</name>
                        <value>8</value>
                   </parameter>
              </ResourceParams>
    - Saish
    "My karma ran over your dogma." - Anon

  • Reload web-inf/web.xml file without restarting tomcat

    Please help me if any one have a solution .
    I am doing development in jsp, servlet. I am using tomcat5 as a webserver.
    i want to reload web-inf/web.xml file without restarting tomcat.

    From the tomcat admin page you can stop/start and refresh individual applications. See the tomcat documentation. Which, when you have a question about tomcat, you should always do first.

  • How to deploy the web.xml file when trying to use the JSP SDK from SAP?

    I want to use the adduser.jsp which downloaded form SAP SDK samples to add user in BO, but I cannot run it sucessfully. I believe it's caused the web.xml file was not deployed appropriately.
    could you please teach how to deploy the web.xml file for the JSP samples ?
    Could you show me some sample of web.xml for the SDK jsp files? Thank you very much!

    Ensure that you have followed below directory structure while deploying your web application.
       web_application_name
          WEB-INF
             lib
             classes
    web.xml must be placed in WEB-INF. Ensure that you have included all the jar files and other necessary files in your application.
    For more information refer to the below link:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
    Regards,
    Anuj

  • How to avoid inserting CheckSessionFilter in to the web.xml file?

    Mobile Server modifies the web.xml during adding a .war-file to the publication. A new entry- CheckSessionFilter will be inserted inside the web.xml after uploading to the mobile server:
    ****************** inserted part **********************
    <filter>
    <filter-name>CheckSessionFilter</filter-name>
    <filter-class>oracle.lite.web.CheckSessionFilter</filter-class>
    </filter>
    <filter-mapping>
    <filter-name>CheckSessionFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>
    ****************** inserted part **********************
    Our application has own security-concept and don’t need this additional session checking.
    How can we avoid including of CheckSessionFilter in to our web.xml?

    Don't do "add a war option" Instead, package your application using packaging wizard omitting the filter. Or, you can edit the WEB-INF/web.xml file on the mobile server after you deploy it.
    Make you update the APPLICATIONS table
    UPDATE APPLICATIONS
    SET PUBLISH_TIME = SYSDATE
    WHERE NAME = 'you application';
    You application will be uploaded to:
    STANDALONE
    ORACLE_HOME/mobile_oc4j/j2ee/application/mobileserver/applications/yourapplication/WEB-INF/web.xml
    IAS
    ORACLE_HOME/j2ee/application/mobileserver/applications/yourapplication/WEB-INF/web.xml

  • How can I get the context-parm from a web.xml file using struts?

    Hello:
    I need get the context-param from the web.xml file of my web project using struts. I want configurate the jdbc datasource connection pooling here. For example:
    <context-param>
    <param-name>datasource</param-name>
    <param-value>jdbc/formacion</param-value>
    <description>Jdbc datasource</description>
    </context-param>
    and then from any Action class get this parameter.
    Similar using a simple server can be:
    /** Initiates new XServlet */
    public void init(ServletConfig config) throws ServletException {
              for (Enumeration e = config.getInitParameterNames(); e.hasMoreElements();) {
                   System.out.println(e.nextElement());
              super.init(config);
              String str = config.getInitParameter("datasource");
              System.out.println(str);
         public void doPost(HttpServletRequest req, HttpServletResponse res)
              throws ServletException, IOException {
              // res.setContentType( );
              System.out.println("Got post request in XServlet");
              PrintWriter out = res.getWriter();
              out.println("nada");
              out.flush();
              out.close();
    but only this works for init-params, if I use
    <servlet>
         <servlet-name>MyServlet</servlet-name>
         <display-name>MyServlet</display-name>
         <servlet-class>myExamples.servlet.MyServlet</servlet-class>
         <init-param>
         <param-name>datasource</param-name>
         <param-value>jdbc/formacion</param-value>
    </init-param>
    </servlet>
    inside my web.xml. I need something similar, but using struts inside the action class for that I can get the context-params and call my database.
    Thank you

    To get context parameters from your web.xml file you can simply get the ActionServlet object from an implementing action object class. In the perform (or execute) method make the following call.
    ServletContext context = getServlet().getServletContext();
    String tempContextVar =
    context.getInitParameter("<your context param >");

  • How to edit the web.xml file

    hi friends,
    i have been working with netbeans for webapplications so far therefore its not ever been requerd to edit the web.xml file that automatically done by IDE itself.
    now, i am just trying to deploy the servlet and jsp's externally without using any tool and i found a requrement to map the servlet and jsp in web.xml file. when i try to edit inside this file it seems noneditable, nothing gonna change. i have an alternate to do this is firstly copy the content of this file into txt file and after making the requred changes overwrite this file in .xml formate to orignal web.xml file.
    am i going in right way?? please help me
    regards
    san

    open it in a text editor and modify it.
    %

  • Web.xml problem in tomcat web hosting site

    Hi i need help in this... its urgent
    currently i just subscribe to a web hosting site and i need to start the private tomcat in the web server..
    The followings are the instructions and i have follow them but i do not know how to create a web.xml file to store in the folder indicated for example a HelloServlet that im testing :
    To setup servlet, you need to configure servlet into the file web.xml which needs to be placed in /var/www/html/WEB-INF directory.
    www root directory or webapps:/var/www/htm
    Classes directory located in: /var/www/html/WEB-INF/Classes/
    There you will need to upload your Java class file.
    Our default url-mapping for servlet is: /servlet/*
    To check servlet in your browser: www.mydomain.net/servlet/HelloWorld
    Jsp Files - Upload anywhere in /var/www/html
    all the above steps are follow except the web.xml file which i suppose to write and store in the folder... but i actually try to write one but i still cannot load my servlet on the webpage... test on standalone tomcat works.
    pls help its urgent!!!

    Please don't cross post
    http://forum.java.sun.com/thread.jsp?thread=500509&forum=45&message=2366915

  • I  have some more problem in the  web.xml file and url-pattern in my  syste

    HI ALL!
    How can I create and place the web.xml and URL-parrten.Because I run
    the tomcat in my computer with ME system.
    Hoc

    what is the problem? please be more specific and detailed? check a sample web.xml file and make your own one and place it in your <application-context>\WEB-INF folder..

Maybe you are looking for