You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ron Bolin <rb...@issl.atl.hp.com> on 2001/01/03 16:13:25 UTC

Re: Pre-compiled JSPs in action.xml path=URI possible ??

>

Is struts designed to work with pre-compiled JSPs? Is it possible in struts
1.0 to define and
use classes in the forward path argument rather than JSP as shown below. I am
interested
in speeding up the initial screens in our project.

I have been toying with this, bus so far have not been able to get it to work.

Any insight would be appreciated. The example below does not reflect the new
Struts 1.0
ActionMappings, but is being presented for clarification.

Example using JSP not pre-compiled.

 <!-- Main Administration-->
    <action    path="/mainAdmin"
        actionClass="org.hp.awsadmin.action.MainAdminAction"
      formAttribute="mainForm"
          formClass="org.hp.awsadmin.form.MainForm">
      <forward name="success"              path="/jsp/awsMain.jsp"/>
    </action>

Example using compiled JSP class.

 <!-- Main Administration-->
    <action    path="/mainAdmin"
        actionClass="org.hp.awsadmin.action.MainAdminAction"
      formAttribute="mainForm"
          formClass="org.hp.awsadmin.form.MainForm">
      <forward name="success"              path="/classes/awsMain"/>
    </action>


Thanks in advance.

Ron



Re: Pre-compiled JSPs in action.xml path=URI possible ??

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Ron Bolin wrote:

> >
>
> Is struts designed to work with pre-compiled JSPs? Is it possible in struts
> 1.0 to define and
> use classes in the forward path argument rather than JSP as shown below. I am
> interested
> in speeding up the initial screens in our project.
>
> I have been toying with this, bus so far have not been able to get it to work.
>
> Any insight would be appreciated. The example below does not reflect the new
> Struts 1.0
> ActionMappings, but is being presented for clarification.
>
> Example using JSP not pre-compiled.
>
>  <!-- Main Administration-->
>     <action    path="/mainAdmin"
>         actionClass="org.hp.awsadmin.action.MainAdminAction"
>       formAttribute="mainForm"
>           formClass="org.hp.awsadmin.form.MainForm">
>       <forward name="success"              path="/jsp/awsMain.jsp"/>
>     </action>
>
> Example using compiled JSP class.
>
>  <!-- Main Administration-->
>     <action    path="/mainAdmin"
>         actionClass="org.hp.awsadmin.action.MainAdminAction"
>       formAttribute="mainForm"
>           formClass="org.hp.awsadmin.form.MainForm">
>       <forward name="success"              path="/classes/awsMain"/>
>     </action>
>
> Thanks in advance.
>

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
<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.

>
> Ron

Craig McClanahan