You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by James Turner <tu...@blackbear.com> on 2002/07/03 00:39:50 UTC

Processing an action for an index page?

Maybe this is a common question, but I haven't found an obvious answer.

I'd like to have a URL like http://mysite/webapp/.  Now, if I just wanted 
to have it go to index.jsp or index.html in that directory, I'd know how to 
do it.

However, what I'd like to do is have Struts process the request through the 
controller, so I can do things like process cookies and look up user state 
in an Action bean before the index page is displayed.  If I had the user 
type in a URL like "http://mysite/webapp/index.do", I could force the 
initial trip through the controller, but I don't know (short of having an 
index.jsp that just does an immediate redirect to a ".do" page) how to make 
Struts process the welcome page.

Any thoughts?
James


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


Re: Processing an action for an index page?

Posted by Dave Dribin <da...@dribin.org>.
On Tue, Jul 02, 2002 at 04:01:13PM -0700, Max Cooper wrote:
> Put something like this in your web.xml file:
> 
>   <welcome-file-list>
>     <welcome-file>/MyAction.do</welcome-file>
>   </welcome-file-list>

I remember having problems with this (at least making index.do a
welcome file).  I think it is because there is actually no file named
"index.do" so some webservers (resin and apache+resin, I believe) give
you a 404 because of this.  I ended up using an index.jsp with a
redirect to index.do.  Perhaps that's the most portable method.

-Dave

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


Re: Processing an action for an index page?

Posted by Max Cooper <ma...@maxcooper.com>.
Put something like this in your web.xml file:

  <welcome-file-list>
    <welcome-file>/MyAction.do</welcome-file>
  </welcome-file-list>

-Max

----- Original Message -----
From: "James Turner" <tu...@blackbear.com>
To: <st...@jakarta.apache.org>
Sent: Tuesday, July 02, 2002 3:39 PM
Subject: Processing an action for an index page?


> Maybe this is a common question, but I haven't found an obvious answer.
>
> I'd like to have a URL like http://mysite/webapp/.  Now, if I just wanted
> to have it go to index.jsp or index.html in that directory, I'd know how
to
> do it.
>
> However, what I'd like to do is have Struts process the request through
the
> controller, so I can do things like process cookies and look up user state
> in an Action bean before the index page is displayed.  If I had the user
> type in a URL like "http://mysite/webapp/index.do", I could force the
> initial trip through the controller, but I don't know (short of having an
> index.jsp that just does an immediate redirect to a ".do" page) how to
make
> Struts process the welcome page.
>
> Any thoughts?
> James
>
>
> --
> 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: Processing an action for an index page?

Posted by Kevin Henrikson <ke...@openwave.com>.
I think most people just do as you guessed.  Put a simple index.jsp that
forwards to your initial action.  That's how we do it.

-kevin

> -----Original Message-----
> From: James Turner [mailto:turner@blackbear.com]
> Sent: Tuesday, July 02, 2002 3:40 PM
> To: struts-user@jakarta.apache.org
> Subject: Processing an action for an index page?
>
>
> Maybe this is a common question, but I haven't found an obvious answer.
>
> I'd like to have a URL like http://mysite/webapp/.  Now, if I just wanted
> to have it go to index.jsp or index.html in that directory, I'd know how to
> do it.
>
> However, what I'd like to do is have Struts process the request through the
> controller, so I can do things like process cookies and look up user state
> in an Action bean before the index page is displayed.  If I had the user
> type in a URL like "http://mysite/webapp/index.do", I could force the
> initial trip through the controller, but I don't know (short of having an
> index.jsp that just does an immediate redirect to a ".do" page) how to make
> Struts process the welcome page.
>
> Any thoughts?
> James
>
>
> --
> 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>