Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How to process servlets on Java Web Server as static contents are being returned by server?

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation How to process servlets on Java Web Server as static contents are being returned by server?

    Hello Friends.
    I am working on Java Web Server. Static contents are being returned by server. But I have to process Servlets. How can I do it?
    I can get Servlet position from Web.xml and all other info of Servlets. But how can I process it?
    Web server first call intit() method of servlet, then service(), then destroy(). I am unable to understand, how it can b done?
    Please guide me.


  2. #2
    Junior Member
    Join Date
    Jul 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Web Server

    It's not completely cleare for me what you are tryin to say. Do you want to map URL's to certain controllers? Or do you want to implement your own servlet?

    In the first case: Use the web.xml to define the servlet and map it to an URL pattern like *.htm. When this matches, the application server will use the [yourservletname]-servlet.xml to match a certain URL pattern to a controller.

    In the second case: use the first case to understand the construct. Then use google to find out how a servlet works. I'm not quite sure because I always use the default one that comes with Spring.

  3. #3
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Java Web Server

    I think he is actually writing a web server/servlet container.

    You could try using reflection to create the servlet etc. Just look in the web.xml for the servlet definition and grab the class.

    Use reflection to create an instance of that object -> Trail: The Reflection API (The Java™ Tutorials)


    // Json

Similar Threads

  1. Replies: 10
    Last Post: May 8th, 2009, 11:49 AM
  2. Java NullPointer Exception in Server chat program
    By Valtros in forum Exceptions
    Replies: 1
    Last Post: May 8th, 2009, 06:06 AM