tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yannick Haudry" <yhau...@gmail.com>
Subject Re: the tomcat welcome file one struts action
Date Sun, 09 Sep 2007 16:47:40 GMT
Create a simple index.jsp and declare it as your welcome file in web.xml:
<welcome-file-list>
  <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

In this jsp, make use of a logic redirect to actually redirect to your
action through a global ActionForward:
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<logic:redirect forward="welcome" />

Then update your struts-config.xml accordingly :
<global-forwards>
  <forward name="welcome" path="/Index.do"/>
</global-forwards>

<action-mappings >
 <action path="/Index"
        scope="session"
    type="com.domain.struts.index.action.IndexAction">
  <forward name="success" path="/WEB-INF/JSP/index/index.jsp" />
  <forward name="error" path="/WEB-INF/JSP/error/errorGeneral.jsp" />
 </action>
</action-mappings>

Hope it helps
Yannick

On 9/9/07, Hassan Schroeder <hassan.schroeder@gmail.com> wrote:
> On 9/9/07, Miren Urkixo <miren@tinieblas.com> wrote:
>
> > And into the web.xml i have:
> >
> > <welcome-file-list>
> >   <welcome-file>/Index.do</welcome-file>
> > </welcome-file-list>
>
> I believe that should be "index.do" rather than "/index.do".
>
> (And presumably not starting with an upper-case "I"...)
>
> FWIW,
> --
> Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message