You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Calvin Lau <al...@yahoo.com> on 2001/07/13 14:05:06 UTC
Welcome Page Action
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.
Any ideas would be very appreciated. Thanks,
Calvin
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
RE: Welcome Page Action
Posted by Tim Colson <tc...@cisco.com>.
Ted suggested this solution to solve having a welcome page redirect to a
struts action.
I tried it but encountered an issue because my default action requires
tomcat-based authentication.
Ex. path="/protected/mainmenu.do"
The redirect to this action works for http://host:8080/myapp/ ->
mainmenu.do, however, the user is not prompted for authentication.
Presumably because authentication (handled in web.xml for all /protected/*
URI's) happens prior to the struts logic:forward activity.
mainmenu.do freaks out a bit, because it expects to only be seen by an
authenticated user.
Suggestions on how one might fix that?
Thanks,
Timothy
> 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.
>
Re: Welcome Page Action
Posted by Ted Husted <hu...@apache.org>.
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.