"Chen, Gin" <[EMAIL PROTECTED]> writes:

>         I want to have my webapplication come in to a servlet instead of a
> JSP. I know with JSPs and/or HTML index files, you can name them in the
> welcome file list. But how do you do that for a servlet?

Not all containers support doing that. However, I think that will be
fixed in a while.

You'll have to try out a few servlet containers to find out, or
consult the thread we had on this a while ago.



> I know the specs say that it has to be either a jsp or html file

I don't think the spec does say that.


> Anyhow, I've tried just putting in a mapping for the
> Servlet in welcome file. Making a new mapping for the Servlet that gives it
> a URI with an extension of both .jsp and .html and using those in the
> welcome file list and a host of other attempted "hacks". But so far,
> no go.
>
>         I've kind of fallen back to the solution of having an actual
> index.jsp that just does a jsp:forward to my Servlet for now. Still hoping
> something so easy can be done.

Jason Hunter suggested this method to me, I rather like it:


   <servlet>
     <servlet-name>MyIndexer</servlet-name>
     <servlet-class>...</servlet-class>
   </servlet>

   <servlet-mapping>
     <servlet-name>myIndexer</servlet-name>
     <uri-pattern>*.index</uri-pattern>
   </servlet-mapping>

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


This ensures that the servlet recieves the full path to the
index. It's quite a clever trick.

However, as I say, not all servlet engines support this. The problem
is that many containers have taken the need for an index file to mean
"just and HTML or JSP file" and haven't implemented a servlet mapping
lookup when an index might be needed.



Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to