You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by to...@jablko.ca on 2002/07/12 22:07:22 UTC

Directory Index

I know that in Tomcat I can map servlets to the path "/" and that in Apache I can set certain files to be "directory indexes"; however, I do not know how to map a JSP to the path "/". Can anyone help? How do I map JSPs to the path "/" or set them as "directory indexes"?

Thanks,

Jack

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Directory Index

Posted by Nathan Smith <na...@labpro2000.com>.
    JSP files are handled by default by the tomcat container's own web.xml
file so take a look at that, you might be able to put your own mapping into
your web application's web.xml file.

     Also to use a *.jsp as a welcome file you just include this piece of
code:
                                    <welcome-file-list>

<welcome-file>index.jsp</welcome-file>
                                    </welcome-file-list>
The filename can be whatever you want and you can also have a list of files
with different name and extensions. If you list more than one file you must
wrap it in the <welcome-file></welcome-file> element. The welcome file list
should be placed in your web application's web.xml file after any servlet
mapping elements and before any taglib elements.

Hope this helps,

Nathan.


----- Original Message -----
From: <to...@jablko.ca>
Sent: Saturday, July 13, 2002 8:07 AM
Subject: Directory Index


> I know that in Tomcat I can map servlets to the path "/" and that in
Apache I can set certain files to be "directory indexes"; however, I do not
know how to map a JSP to the path "/". Can anyone help? How do I map JSPs to
the path "/" or set them as "directory indexes"?
>
> Thanks,
>
> Jack
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Directory Index

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
This is actually a bit tricky and took some research into Apache.
Since the jsp files must be within Tomcat and cannot be under an apache
directory, you have to find another way of mapping / to a file.

So, this is the way:

----------------------------------------------------------------------------
----

## MOD_JK
LoadModule jk_module modules/mod_jk.so
JkWorkersFile /apache/conf/workers.properties
JkLogFile /apache/logs/mod_jk.log
JkLogLevel debug
AddModule mod_jk.c

<VirtualHost *:80>
	ServerName myserver.com
	DocumentRoot /apache/html/myserver
	ErrorLog /apache/logs/myserver_error
	CustomLog /apache/logs/myserver_custom myserver

	<IfModule mod_dir.c>
         DirectoryIndex index.jsp index.html
	</IfModule>

	<IfModule mod_alias.c>
	   RedirectMatch   ((/.*|)/)$  $1index.jsp
	</IfModule>
	<Directory "/">
	   Options Indexes MultiViews
	   AllowOverride None
	   Order allow,deny
	   Allow from all
	</Directory>

	# Include File for Tomcat mod_jk
	JkMount /*.jsp  ajp13
	JkMount /*.do   ajp13

</VirtualHost>

----------------------------------------------------------------------------
----

The "mod_dir.c" is what you normally have.  Map index.jsp as the index.
I don't even think this section is necessary because of what "mod_alias.c"
does.

The "mod_alias.c" tells apache to change any request that ends in "/"
into a requst for "/index.jsp".  Then "mod_jk" sees the request for *.jsp
and points it to Tomcat.

Yes.  Weird.  I just figured this out about two weeks ago.  And it works
really
well.  When you click on http://myserver.com/  you will see the url change
into
http://myserver.com/index.jsp and then find Tomcat.

Give it a try and see if it works.


Charlie



> -----Original Message-----
> From: dc2033@columbia.edu [mailto:dc2033@columbia.edu]
> Sent: Friday, July 12, 2002 4:19 PM
> To: Tomcat Users List
> Subject: Re: Directory Index
>
>
>
> Jack, I'm not sure I understand what you're asking but, in case I did
> understand your question correctly, try putting this into your web.xml
>
>   <welcome-file-list>
>     <welcome-file>
>       MyJspIndexPage.jsp
>     </welcome-file>
>   </welcome-file-list>
>
> Darya
>
>
> On Fri, 12 Jul 2002 tomcat-user-list@jablko.ca wrote:
> > I know that in Tomcat I can map servlets to the path "/" and that in
> > Apache I can set certain files to be "directory indexes"; however, I do
> > not know how to map a JSP to the path "/". Can anyone help? How do I map
> > JSPs to the path "/" or set them as "directory indexes"?
> >
> > Thanks,
> >
> > Jack
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Directory Index

Posted by Darya Chernikhova <dc...@columbia.edu>.
Jack, I'm not sure I understand what you're asking but, in case I did
understand your question correctly, try putting this into your web.xml

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

Darya


On Fri, 12 Jul 2002 tomcat-user-list@jablko.ca wrote:
> I know that in Tomcat I can map servlets to the path "/" and that in
> Apache I can set certain files to be "directory indexes"; however, I do
> not know how to map a JSP to the path "/". Can anyone help? How do I map
> JSPs to the path "/" or set them as "directory indexes"?
>
> Thanks,
>
> Jack
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>