David
From: Jason Lea <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Re: Filter to redirect to welcome action when pre-compiling JSPs Date: Tue, 25 Mar 2003 18:01:54 +1200
Cool. It's good to know someone else has done this. I thought I should post this just so someone else looking at pre-compilation of JSPs would find it useful, but also to see if there are any glaring issues or if it is a Good Thing (TM) :-)
Jason
David Graham wrote:This is exactly what I did :-).
David
From: Jason Lea <[EMAIL PROTECTED]> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> To: Struts Users Mailing List <[EMAIL PROTECTED]> Subject: Filter to redirect to welcome action when pre-compiling JSPs Date: Tue, 25 Mar 2003 17:47:14 +1200
I have been playing around with JSP pre-compilation with Tomcat-4.1.24 (http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html) so I can check my JSP pages for compiler errors before deployment, but also to remove the delay that the first hit incurs.
The only problem with this is the <welcome-file> which has to point to a physical jsp page and not a servlet. The Struts in Action book suggests using a index.jsp page with a <logic:redirect> to a Welcome action, which is what I was doing.
I tried creating a servlet that would forward the request onto my Welcome action & servlet-mapping with a <url-pattern>/<url-pattern>, but this seemed to match any request and cause lots of problems.
So I dropped that idea and instead have used a filter...
<filter-mapping> <filter-name>WelcomeFilter</filter-name> <url-pattern>/</url-pattern> </filter-mapping>
which works perfectly. It only fires for http://localhost/app/ or http://localhost/app and my filter forwards the request onto my Welcome action correctly.
I can now get rid of index.jsp and all my other JSPs are pre-compiled. I have also hidden all of my JSPs under the WEB-INF so they cannot be called directly and have to go through my Struts actions.
Jason Lea
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Jason Lea Email: [EMAIL PROTECTED] Phone/Fax: +64 3 381 2907 Mobile: +64 21 040 2708 Address: 9a Tabart Street, Christchurch, New Zealand
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]