That's how I do it, except I use jsp:forward, like so:
<%@ page language="java" contentType="text/html;
charset=UTF-8" pageEncoding="ISO-8859-1"%>
<jsp:forward page="/action/mybean" />
BTW, the comment in your JSP says "redirect" instead of "forward."
-Ben
On Wed, Dec 29, 2010 at 6:26 AM, Janne Jalkanen <janne.jalka...@ecyrd.com>wrote:
> Folks,
>
> to follow up on this, it seems that the simplest way to accomplish an
> URLBinding to "/" is to create an "/index.jsp" -file which has the following
> contents:
>
> <%@ page language="java" contentType="text/html; charset=UTF-8"
> pageEncoding="ISO-8859-1"%>
> <%
> //
> // We just simply redirect to the proper actionbean.
> //
>
> request.getRequestDispatcher( "/action/mybean"
> ).forward(request,response);
> %>
>
> Also ensure that index.jsp is in your welcome-file-list.
>
> There seems to be no more performance penalty on Tomcat 6, oddly enough.
> You'll just need to be careful that you have your Servlet Filters mapped
> properly in web.xml, since RequestDispatcher.forward() does not rerun the
> filter chain. (FWIW, I tried setting up REQUEST and FORWARD dispatchers for
> StripesFilter, but got very quickly into infinite loops, which were severely
> detrimental to the performance of my web site. So just map the filters you
> need properly for *.jsp and you should be fine.)
>
> This change alone bumped my Yottaa score up by 10 notches compared to just
> blindly mapping action/mybean as a welcome-file. :-)
>
> /Janne
>
> On 29 Dec 2010, at 00:31, Janne Jalkanen wrote:
>
> > Hi folks!
> >
> > I need to map the root of my site to a particular ActionBean. Now, the
> simple way to do this is of course to use a welcome-file-list in web.xml
> (Tomcat 6.0.x):
> >
> > <welcome-file-list>
> > <welcome-file>action/mybean</welcome-file>
> > </welcome-file-list>
> >
> > but unfortunately this carries a fairly heavy performance penalty:
> compared to accessing action/mybean directly, the performance on EC2 Large
> instances is up to 100ms slower - and I'm seeing a definite bump in CPU
> usage as well (about 5x of what I would use normally). On my local OSX box
> the difference isn't that bad, but I'm still seeing it, especially the CPU
> usage. There's no considerable IO.
> >
> > So it seems that the welcome-file solution is less than ideal in my
> environment, and before I go and start ripping the guts out of it (or worse,
> changing my production environment), I'm wondering if there's a simple and
> clean way to resolve this the Stripes way. I see
> http://stripesframework.org/jira/browse/STS-688 has some discussion.
> >
> > Would a custom Servlet Filter be the best solution here? If so, then how
> would I invoke a particular ActionBean from it?
> >
> > (Here's the interesting part - it's slightly *faster* to have an
> index.jsp redirecting with 302 to /action/mybean than have the
> /action/mybean as the welcome-file. However, I want to steer away from
> redirects, since 1) I want clean URLs, and 2) redirects can be quite bad for
> performance, especially on mobile networks. And 3) it bothers me that this
> should really be faster than have an extra redirect loop... I'm wondering if
> having an ActionBean as a welcome-file somehow confuses Tomcat when the file
> does not exist physically.)
> >
> > /Janne
>
>
>
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment,
> and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users