How to publish a servlet class to web server?

background:
web server: tomcat apache 4
context path: webapp\test\
servlet path: webapp\test\WEB-INF
servlet name: HelloWorld.class
i tried to placed the servlet class file to above servlet path,
but i can't invoke the servlet by http://localhost:8080/test/HelloWorld
what should i do in order to invoke the servlet at browser?
Is a web.xml necessary a must to provided a mapping between request name and actual class name?

First of all you need a *.war structure which look like this
/app-name
/app-name/WEB-INF/
/app-name/WEB-INF/lib
/app-name/WEB-INF/classes
When you have created this structure you add your servlet (HelloWorld.class) in the classes directory (Create the package structure first).
When this is done you need to map the servlet to a given uri which is done in the web.xml. An example is found below:
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>package.HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
Hopefully this will help :-)
best regards
Stig

Similar Messages

  • Urgent-How to publish the screen in the web?

    Hi,
    I created a screen in SRM system, and wanted to publish the screen in the web, can any one tell me how to publish the screen in the web?
    thanks
    Murali

    Hi,
    R u want to publish ur screen in ITS .Then you have to create a IAC in SE80 internet service file.Rgt click the service and publish or run the pgm <b> w3_publish_services </b>,slt your serive and publish ?
    Cud you specify how you want to publish ? Thru ITS / BSP / EP ?
    Rgds,
    Jothi.
    Mark useful answers.

  • Could not load servlet information from web server

    I am trying to register a servlet through the web object manager.
    As soon as click the web object manager menu pick I get the following
    error: Could not load servlet information from web server.
    On other peoples machines here it works fine and they can register
    servlets. What am I missing!

    You must be using Jdev 3.2.x, this is a known bug. In Jdev 9.0.2 we use the standard J2EE web.xml in order to register servlets. You should consider moving to the new IDE.

  • How to run java servlet without using Web.xml?

    How to run servlet without using Web.xml? From a book, I know that web.xml descriptor is optional, but the book doesn't tell us how to run java servelet without web.xm descriptor. So how to do that? Thanks a lot.

    How to run servlet without using Web.xml?But Tomcat now uses a web.xml for its global server-wide configuration.
    If you'd like to invoke a servlet with:
    http://host/servlet/ServletName
    you have to enable the invoker servlet.
    [from an HTML]
      <FORM METHOD="POST" ACTION="/servlet/HGrepSearchSJ">
    [from resin.conf of Resin Web Server 2.1.12]
      <!--
         - The "invoker" servlet invokes servlet classes from the URL.
         - /examples/basic/servlet/HelloServlet will start the HelloServlet
         - class.  In general, the invoker should only be used
         - for development, not on a deployment server, because it might
         - leave open security holes.
        -->
      <servlet-mapping url-pattern='/servlet/*' servlet-name='invoker'/>
    [from TOMCAT5.0.19/conf/web.xml, a global server-wide web.xml file]
      <!-- The "invoker" servlet, which executes anonymous servlet classes      -->
      <!-- that have not been defined in a web.xml file.  Traditionally, this   -->
      <!-- servlet is mapped to URL pattern "/servlet/*", but you can map it    -->
      <!-- to other patterns as well.  The extra path info portion of such a    -->
      <!-- request must be the fully qualified class name of a Java class that  -->
      <!-- implements Servlet (or extends HttpServlet), or the servlet name     -->
      <!-- of an existing servlet definition.     This servlet supports the     -->
      <!-- following initialization parameters (default values are in square    -->
      <!-- brackets):                                                           -->
      <!--                                                                      -->
      <!--   debug               Debugging detail level for messages logged     -->
      <!--                       by this servlet.  [0]                          -->
        <servlet>
            <servlet-name>invoker</servlet-name>
            <servlet-class>
              org.apache.catalina.servlets.InvokerServlet
            </servlet-class>
            <init-param>
                <param-name>debug</param-name>
                <param-value>0</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
        </servlet>
    ---comment out below----------------------------------------------------------
        <!-- The mapping for the invoker servlet -->
    <!--
        <servlet-mapping>
            <servlet-name>invoker</servlet-name>
            <url-pattern>/servlet/*</url-pattern>
        </servlet-mapping>
    -->

  • How to publish edge projects to the web?

    I've never published edge projects to the web before.
    Sorted the web settings out to what I need but wondering but do I need to upload the whole edge project file (with the edge project, edge includes etc) or just the publish folder?
    Thanks
    Robyn

    Hi Robyn
    The contents of the publish folder is all what is needed to deploy.
    PS: the publish folder might have two directories, 'Web' and '.oam', depending on your publish settings. For publishing projects to Web, You only need (all the) contents of the 'Web' directory. If you have uncheked the CDN option in publish settings, then edge_includes directory will be available in Published content.
    I hope that answered your query.
    Thanks
    Manigandan

  • How to publish PSE slideshow to the web

    I can't seem to figure how to publish the slideshow I created in PSE 7; I have a website, and want to post the show on it. Are my only options to save it as a .wmv file or a .pdf?? I can get the .pdf to publish, but when I try to publish the .wmv to my site, all that pops up is the black Media Viewer box and an error message that says the file cannot be found.
    Any idea what I may be doing wrong?

    The problem is that you are using formats that are not suitable. For some people, a pdf is always going to show as just a download (and that will put plenty of stress on your bandwidth if lots of friends are downloading those slideshows). The WMV file is also not quite the way to do it. The better solution is to create a so-called online album, which is really a flash slideshow, and upload that to the server of your choice.

  • Question on Running Servlet on a Web Server

    Hi,
    I got an example servlet here:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class HelloWorldServlet 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("<body>");
    out.println("<head>");
    out.println("<title>Hello World!</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Hello World!</h1>");
    out.println("</body>");
    out.println("</html>");
    I compiled this into HelloWorldServlet.class and sent it to a web server. How can I use a web browser to check if it is running on the web server? I am supposed to see "Hello World" in my browser, right?
    Do I need to run J2EE server on the web server?
    Many thanks in advance.
    yaol

    Must to have Apache Tomcat. Take a look at http://www.webmasterbase.com/article/305 .

  • How to set up a FTP and web server and integrate with DMM 5.2

    Hi All ...
    I need to set up a external server only for content publishing to reduce the overhead of the DMM server .
    can anyone guide me on how to set up the external server and intergrate it with the DMM 5.2
    Thanks

    semuthu,
    Notes from the Release Notes:
    Compatibility Limitations with Microsoft Internet Information Server (IIS)
    DMPs that use firmware release 5.2 are compatible with only one version of Microsoft Internet Information Server.
    That supported version is IIS 6.0 for Windows 2003 Enterprise. If you do not have the supported IIS version but
    want your DMPs to retrieve assets from a webserver, we recommend that you use Apache instead of IIS.
    I would suggest using Apache instead of IIS for the webserver service. IIS can be used as FTP if needed.
    There are plenty of Documents on the Web about setting up Apache and FTP for servers.
    Using Apache with Microsoft Windows
    http://httpd.apache.org/docs/2.0/platform/windows.html
    Quick HOWTO : Ch20 : The Apache Web Server
    http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch20_:_The_Apache_Web_Server
    Once the Webserver is setup and operational. You simply store your media content on the Webserver
    and then have your DMS assets in the media library use an external URL address for its location.
    If you want to use external server for other features in the DMM, you can can see how to configure
    here:
    http://www.cisco.com/en/US/partner/docs/video/digital_media_systems/5_x/5_1/dmm/user/guide/dsm+etv.html#wp1073210
    Goto the section right below ACNS & WAAS..
    If this answers your question, Please take time to mark this
    discussion answered & rate the response.
    Thank You!
    T.

  • How to change the date path of Web Server to my system time?

    Hi,
    I have downloaded a Countdown SWF file from the Internet. It is working fine with the Computers which have Internet Connection. But not working without Internet connection because of the following line of code in XML file:
    <PHPurl>http://www.flepstudio.org/utilita/CountDown/gettime.php</PHPurl>
    When I opened the webpage using the above code, it shows time in a typical digits:
    Monday, October 18, 2010 9:12:52 PM in my System -shows in Web browser like : time=1287425579
    How to modify the code so that I can use my System time to work with Countdown without Internet Connection.
    The following is the path from where I have downloaded the Countdown file:
    http://www.flepstudio.org/forum/flepstudio-utilities/2960-flash-cs3-countdown.html
    Please help me to run this countdown without internet access.
    Thanks.

    It appears all that php file does is return a time=value variable.  So you need to see where that time variable is implemented in the Flash file and assign it a value using the Date.getTime() method instead of having the PHP file get called into play.  Look in the help documents or Google if you do not know how to use the Date class.

  • Running Servlet with J2EE Web Server

    Hi experts
    My web server is J2EE. I have compiled the servlet classes and have put them in the web-inf/classes directory. I have also declared the servlets in the web.xml file in the web-inf directory.
    When I run this, it gives error HTTP Status 404 - /fijidirectory.
    Experts can you help me with this pliz.
    Deepak

    Now the code looks like this.
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <display-name>J2EE Servlet Config</display-name> 
      <servlet>
        <servlet-name>dirinterface</servlet-name>
        <servlet-class>DirectoriesInterface.DirInterface</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>dispplaydirinfo</servlet-name>
        <servlet-class>DirectoriesInterface.DispplayDirInfo</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>fijidirmain</servlet-name>
        <servlet-class>DirectoriesInterface.FijiDirMain</servlet-class>
      </servlet>
      <servlet>
        <servlet-name>whitedirinterface</servlet-name>
        <servlet-class>DirectoriesInterface.whiteDirInterface</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>dirinterface</servlet-name>
        <url-pattern>/FijiDirectory</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>dispplaydirinfo</servlet-name>
        <url-pattern>/dirInfo</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>fijidirmain</servlet-name>
        <url-pattern>/fiiidirectory</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
        <servlet-name>whitedirinterface</servlet-name>
        <url-pattern>/whfd</url-pattern>
      </servlet-mapping>
    </web-app>
    The url that I am using to access the system is: http://localhost:8080/whfd

  • Global data in a servlet using iPlanet Web Server

    Our configuration is an Applet->Servlet->JNI->C/C++ code.
    We have C code that does a number of lengthy mathematical calculations. This C code not only uses its own global variables but, it is also comprised of numerous subroutines that all call each other, reading and writing global C variables as they go. These globals are all isolated to the C code shareable object (.so) library that is included using the LoadLibrary call when the servlet is initialized.
    The problem is that in a multi-user environment (3-5 simultaneous users) we need to have each user have their own "copy" of the servlet (and the C code) so that users will not be accessing each other's global data. We can NOT have only one copy of the C code and define it as synchronized because the calculations that are performed can take a very long time and we can not hold off user requests while the firs user finishes.
    Our hope is that there is a way to configure the iPlanet Web server such that each new user that starts up a copy of the Applet/Servlet combination will get their own "space" so that they can work independently of any other user. We have at most 20 users of this system and only 3-5 simultaneous users so we should not have a problem with memory or CPU speed.
    If anyone has a solution, I would greatly appreciate it!

    The C library is shareable. But you don't want it to be shared. That's your question summarized, isn't it?
    You probably can't prevent it from being shared, so to prevent multiple use of it you would have to queue up the requests to be done one at a time. WynEaston's suggestion of having the servlet implement SingleThreadModel would help, but I believe the servlet spec allows servers to run multiple copies of a servlet that does that (as opposed to running a single copy in multiple threads).
    Your other alternative is to rewrite the math in Java, or at least in some object-oriented language where you don't need global variables (which are the source of your problem). All right, I can already hear you saying "But that wouldn't be as fast!" Maybe not, but that isn't everything. Now you have a problem in queueing theory: do you want a single server that's fast, but jobs have to wait for it, or do you want multiple servers that aren't as fast, but jobs don't have to wait? That's a question you would have to evaluate based on the usage of your site, and it isn't an easy one.

  • How to send a request to a web server

    Hi All!
    How can I send a request to a web server using java.net package? Can any one give me a simple example?
    thanks,
    Padma.

    http://javaalmanac.com/egs/java.net/Post.html
    http://www.developer.com/tech/article.php/761521
    http://www.javaworld.com/javaworld/jw-03-2001/jw-0323-traps.html

  • How to delete Message cache without bouncing web server?

    When a message ( FND_NEW_MESSAGES) that is used in a OA Framework page is updated, it is not reflected in the OA web page right away.
    Clearing cache through Functional Administrator does not help for messages.
    How to delete message cache so that a OA Framework page shows updated message text? Is there any way other than bouncing web server?
    Please let me know.
    Thanks

    Hi,
    I think clearing cache through Functional Administrator should do.
    You can try the below process...
    Search for "_pages" (get in touch with DBA to know exact path) in $COMMON_TOP and remove using command "rm -Rf _pages". Then clear cache through Functional Administrator.
    Let us know if this helps.
    Regards,
    Anand

  • How i can change port that oracle web server listen on in 10gEx

    Hi
    Thank you for reading my psot
    How i can change the port 8080 that oracle web server listen on it ?
    I have other server listening on this port and i can not change that port.
    I have oracle 10g Express edition

    This question has been asked and answered several times in the XE forum. Feel free to join us in the XE forum at Oracle Database Express Edition (XE)
    If you're not registered there, do so using http://www.oracle.com/technology/xe/registration
    The answer is to use dbms_xdb's sethttpport procedure.

  • How to install CR 2008 Basic on web Server

    Hello,
    I'm a web developer using Visual Studio 2008 .NET. Need to install Crystal Report 2008 Basic on web server and can't. Is there any .msi on sap.com to download and install on my web server?
    Thank you

    Hi,
    You can find the MSI's over [here.|https://wiki.sdn.sap.com/wiki/display/BOBJ/Crystal%20Reports%20for%20Visual%20Studio%20.NET%20Runtime%20Distribution%20%20-%20%20Versions%209.1%20to%2012.0]
    Sincerely,
    Nikhil Dharme

Maybe you are looking for

  • I am trying to figure out why my songs are cutting out anywhere in the song and will not play and skip to next.

    Hi my name is jeff. I bought a ipod touch 6 months ago it was working untill now. I am wondering why it can stop at any time during any song and go silent for the rest of the song. Ive been having this problem for 2 days now. Wondering if anyone has

  • Difference postings in customer manual payment

    Hi Has anyone used this option?.. In case of manual payment of customer say from F-28, after choosing open line item if there is a difference in amount from the open line items selected, this can be nullified by offseting the difference amount in a s

  • How can I include a file in a servlet?

    I need to include a header file in htm format and a footer as well. My question here is, is it possible to include these files when a servlet is executed? like in the cases of the jsp web apps, with the <%@include file = "header.htm"%> tag... please

  • Renaming a Project causes error when running locally

    The app uses an HTTPservice on a remote webserver. I have been running the same app locally for weeks. I occasionally publish up to the web server and all has been fine. I renamed the project (in the IDE) but now anytime I try to run the app locally

  • Random Loss of Power

    I have just got a 15" powerbook - It did have a dud battery, I now have a nice new one that charges OK and I have calabrated it... But every now and again when on battery power the machine just looses power, e.g. if you had no battery and pulled the