Can I use precompiled JSPs with Struts?

Ted Husted

There is nothing about Struts that would care about precompiled versus not precompiled JSP pages, but the details of how you set them up depends on the servlet container you are using. With Tomcat, for example, running the "jspc" command line tool will compile all your pages, but it will also create a bunch of lt;servlet> and <servlet-mapping> tags that need to go into your web.xml file. In particular (at least for Tomcat), though, the path of a JSP page does not change when you use precompiled pages. The reason this works is that the compiler generates a servlet mapping for "/jsp/awsMain.jsp" for you -- and, because this is an exact match, it has higher priority than extension mapping on "*.jsp", which would send the page back to the JSP servlet. Try leaving the path for the compiled case the same as the path for the uncompiled case, and make sure that you've included the necessary stuff in web.xml.

Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact