You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by s s <su...@yahoo.com> on 2005/07/02 15:14:24 UTC

servlet mapping and url

i want to invoke a servlet using url like http://localhost:8080 only
 
i have done it using http://localhost:8080/index.html where index.html is a servlet. Is it possible to load this servlet as a default just like a default web page. The point is i want a servlet to recieve a request when url http://localhost:8080 is referenced i.e without the servlet name.
 
is it possible?
 
 


		
---------------------------------
Yahoo! Mail Mobile
 Take Yahoo! Mail with you! Check email on your mobile phone.

Re: servlet mapping and url

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Hi,

I don't think there is any restriction to mapping a servlet to a welcome 
page:

<servlet>
<servlet-name>MyServlet</servlet-name> 
<servlet-class>com.company.app.MyServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyServlet</servlet-name>
<url-pattern>/myServlet</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/myServlet</welcome-file>
</welcome-file-list>

Also, I'm not as sure, put I think just mapping the servlet to / will do 
the trick as well.  Both are easy enough to test though, give it a shot 
and post back your results for the archives.

Frank

s s wrote:
> i want to invoke a servlet using url like http://localhost:8080 only
>  
> i have done it using http://localhost:8080/index.html where index.html is a servlet. Is it possible to load this servlet as a default just like a default web page. The point is i want a servlet to recieve a request when url http://localhost:8080 is referenced i.e without the servlet name.
>  
> is it possible?
>  
>  
> 
> 
> 		
> ---------------------------------
> Yahoo! Mail Mobile
>  Take Yahoo! Mail with you! Check email on your mobile phone.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: servlet mapping and url

Posted by Hardik Tank <ha...@yahoo.com>.
you can configure your web.xml file and make index.jsp
file as an welcome file using,

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

now, create index.jsp file which will simply forward
the request to your servlet!

Rgds,
Hardik

--- s s <su...@yahoo.com> wrote:

> i want to invoke a servlet using url like
> http://localhost:8080 only
>  
> i have done it using
> http://localhost:8080/index.html where index.html is
> a servlet. Is it possible to load this servlet as a
> default just like a default web page. The point is i
> want a servlet to recieve a request when url
> http://localhost:8080 is referenced i.e without the
> servlet name.
>  
> is it possible?
>  
>  
> 
> 
> 		
> ---------------------------------
> Yahoo! Mail Mobile
>  Take Yahoo! Mail with you! Check email on your
> mobile phone.



		
____________________________________________________ 
Yahoo! Sports 
Rekindle the Rivalries. Sign up for Fantasy Football 
http://football.fantasysports.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org