index.jsp:

<%
/**
 * Redirect default requests to Welcome action.
*/
%>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<logic:forward name="welcome"/>

Struts-config: 

    <global-forwards>
         <forward   
            name="welcome"  
            path="/announcements.do"/>
    </global-forwards>

You could also use "announcements" instead of "welcome", but I tend to
standardize on forwarding to Welcome and put the specifics in the
config.


-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


Calvin Lau wrote:
> 
> I'm trying to figure out the best way of making my
> welcome page (index.jsp) run an action that will show
> my annoucements.  I have an AnnouncementsForm that I
> use with announcements.do elsewhere, but I'm not sure
> how I should make the index.jsp page run this same
> action.  Is there any way to map an action to this
> page without making all other .jsp pages go through
> the Action servlet?
> 
> The makeshift solution I have now is to change the
> name of my jsp file to index.do and to make that my
> welcome page.  This hardly seems like a good solution
> though and I would think this problem has come up
> often enough where there's something better.  I
> imagine many welcome pages have dynamic content that
> requires an action to be run.

Reply via email to