wood burning stoves 2.0*
The moose likes Servlets and the fly likes can any body tell how to call servlet withot using web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "can any body tell how to call servlet withot using web.xml" Watch "can any body tell how to call servlet withot using web.xml" New topic
Author

can any body tell how to call servlet withot using web.xml

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153


i am using eclipse.i have Login servlet in default package i have called servlet from login form

<form name="frmlogin" method="get" action="http://localhost:8080/servlet/Login">
my project name is OnlineCourseRegistration

it show error httpresource is not available
i called like this this also not working

<form name="frmlogin" method="get" action="http://localhost:8080/OnlineCourseRegistration/Login">

it show error http resource is not available


thanks in advance


Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
You need a web.xml file to declare the servlet names and classes. Any decent servlet tutorial explains how to do that.


Ping & DNS - my free Android networking tools app
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
Hi,

You cannot execute a servlet without web.xml, configuration for servlet must be there so that the container is able to execute it.


Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
i have web.xml in my application suppose if i didn,t mention servlet name and classes in web.xml can I able to call servlet?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
No.
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
But why you want to do this ?
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
thanks friends just i want to know
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16020
    
  20

Ulf Dittmer wrote:No.


It's considered a security risk. If you like security risks, call Bill Gates. Java was expressly defined to minimize security issues.


Customer surveys are for companies who didn't pay proper attention to begin with.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

You probably don't want to include the host/port information in the form's "action" attribute, by the way.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
Back in the beginning of servlets somebody created the Invoker servlet. With the invoker active you had the appearance of servlet classes in the default package being called without a web.xml entry. This was an illusion because the invoker was really getting the request first - as configured in web.xml.

This was supposed to make it easier for newcomers to experiment with servlets without getting into web.xml but it has proved to be a disaster and caused much more confusion than web.xml ever did.

Bill
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can any body tell how to call servlet withot using web.xml