You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Jin S. Voon" <js...@paradise.net.nz> on 2001/09/30 05:27:31 UTC

Trying to call an action on entry to web page

Hi all,

I'm trying to configure my web application such that when I type the main 
URL such as:

http://localhost/myapp

it will call the action viewHome.do.  In this action, I will get all the 
details I require to display the home page i.e after the action is 
finished, it redirects to a JSP called main.jsp, which will use all the 
details obtained by that action via the database.  However, I am having 
some problem with it, and I suspect that it's my Apache configuration.

I am using Apache as the web server, which redirects all JSP and *.do calls 
to the Tomcat 3.2.2 servlet engine.  In my apache httpd.conf file, I have 
set the DirectoryIndex to viewHome.do index.jsp index.html and in myapp 
web.xml, I've set the <welcome-file-list> to have this entry:

<welcome-file>viewHome.do<welcome-file>

However, the Apache web server does not seem to redirect to the viewHome.do 
action, and instead complains that the file cannot be found!  Has anyone 
got any ideas on this?  If you have a better way to achieve this goal, then 
I would be glad to hear from you! Thanks.

Regards,
Jin


Re: Trying to call an action on entry to web page

Posted by Jonathan M Crater <jo...@fanniemae.com>.
one workaround would be to create an actual JSP that just forwards to the
proper action.  make that jsp the target of the welcome file mapping, and in
that jsp just call one of your global forwards that maps to your viewHome.do
action:

<logic:forward name="viewHome"/>


"Jin S. Voon" wrote:

> Hi all,
>
> I'm trying to configure my web application such that when I type the main
> URL such as:
>
> http://localhost/myapp
>
> it will call the action viewHome.do.  In this action, I will get all the
> details I require to display the home page i.e after the action is
> finished, it redirects to a JSP called main.jsp, which will use all the
> details obtained by that action via the database.  However, I am having
> some problem with it, and I suspect that it's my Apache configuration.
>
> I am using Apache as the web server, which redirects all JSP and *.do calls
> to the Tomcat 3.2.2 servlet engine.  In my apache httpd.conf file, I have
> set the DirectoryIndex to viewHome.do index.jsp index.html and in myapp
> web.xml, I've set the <welcome-file-list> to have this entry:
>
> <welcome-file>viewHome.do<welcome-file>
>
> However, the Apache web server does not seem to redirect to the viewHome.do
> action, and instead complains that the file cannot be found!  Has anyone
> got any ideas on this?  If you have a better way to achieve this goal, then
> I would be glad to hear from you! Thanks.
>
> Regards,
> Jin