You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Billy Ng <kw...@earthlink.net> on 2002/12/16 07:44:54 UTC

Forward to a servlet

Hi folks,

In my Struts app, I am using the Action to call the jsp file.  In the struts-config.xml, the action tag looks like this, 

  <action path="/accounts" 
   type="com.mydomain.AccountsAction"
   name="accountsForm"       
   validate="false"
   input="/WEB-INF/jsp/AccountsHTML.jsp">
   <forward name="accounts" path="/WEB-INF/jsp/AccountsHTML.jsp"/>
  </action>

Because of some deployment issue, I need to pre-compile the jsp files.  I successfully use the ANT's jspc tag to compile the all the jsp files to java files, then compile them to java files.  However, I cannot make it use the servlet in the forward tag.  I tried to do this (AccountsHTML_jsp is class file of the compiled version of AccountsHTML.jsp), but I get 404 page.

  <action path="/accounts" 
   type="com.mydomain.AccountsAction"
   name="accountsForm"       
   validate="false"
   input="/WEB-INF/jsp/AccountsHTML.jsp">
   <forward name="accounts" path="/WEB-INF/ui/AccountsHTML_jsp"/>
  </action>

Would anybody knows how can I make this work?

Thanks in advance!

Billy Ng

Re: Forward to a servlet

Posted by Billy Ng <kw...@earthlink.net>.
So, should I do this?


web.xml
=====
   <servlet>
    <servlet-name>
        AccountHTML_jsp
    </servlet-name>
    <servlet-class>
        com.mydomain.AccountHTML_jsp
    </servlet-class>
   </servlet>
   <servlet-mapping>
    <servlet-name>
       AccountHTML_jsp
    </servlet-name>
    <url-pattern>
       /AccountHTML.jsp
    </url-pattern>
   </servlet-mapping>



struts-config.xml
===========
  <action path="/accounts"
   type="com.mydomain.AccountsAction"
   name="accountsForm"
   validate="false"
   input="/WEB-INF/jsp/AccountsHTML.jsp">
   <forward name="accounts" path="/WEB-INF/jsp/AccountsHTML.jsp"/>
  </action>


Billy Ng

----- Original Message -----
From: "David M. Karr" <dm...@earthlink.net>
To: <st...@jakarta.apache.org>
Sent: Sunday, December 15, 2002 11:25 PM
Subject: Re: Forward to a servlet


> >>>>> "Billy" == Billy Ng <kw...@earthlink.net> writes:
>
>     Billy> Hi folks,
>     Billy> In my Struts app, I am using the Action to call the jsp file.
In the struts-config.xml, the action tag looks like this,
>
>     Billy>   <action path="/accounts"
>     Billy>    type="com.mydomain.AccountsAction"
>     Billy>    name="accountsForm"
>     Billy>    validate="false"
>     Billy>    input="/WEB-INF/jsp/AccountsHTML.jsp">
>     Billy>    <forward name="accounts"
path="/WEB-INF/jsp/AccountsHTML.jsp"/>
>     Billy>   </action>
>     Billy> Because of some deployment issue, I need to pre-compile the jsp
files.  I successfully use the ANT's jspc tag to compile the all the jsp
files to java files, then compile them to java files.  However, I cannot
make it use the servlet in the forward tag.  I tried to do this
(AccountsHTML_jsp is class file of the compiled version of
AccountsHTML.jsp), but I get 404 page.
>     Billy>   <action path="/accounts"
>     Billy>    type="com.mydomain.AccountsAction"
>     Billy>    name="accountsForm"
>     Billy>    validate="false"
>     Billy>    input="/WEB-INF/jsp/AccountsHTML.jsp">
>     Billy>    <forward name="accounts"
path="/WEB-INF/ui/AccountsHTML_jsp"/>
>     Billy>   </action>
>
>     Billy> Would anybody knows how can I make this work?
>
> You don't change your "struts-config.xml" at all to use precompiled JSP
pages.
> You do have to change your "web.xml" file, however, to include the servlet
> mappings for the generated servlets.  You also have to include the
generated
> and compiled servlet class files in your WAR file.
>
> --
> ===================================================================
> David M. Karr          ; Java/J2EE/XML/Unix/C++
> dmkarr@earthlink.net   ; SCJP
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Forward to a servlet

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Billy" == Billy Ng <kw...@earthlink.net> writes:

    Billy> Hi folks,
    Billy> In my Struts app, I am using the Action to call the jsp file.  In the struts-config.xml, the action tag looks like this, 

    Billy>   <action path="/accounts" 
    Billy>    type="com.mydomain.AccountsAction"
    Billy>    name="accountsForm"       
    Billy>    validate="false"
    Billy>    input="/WEB-INF/jsp/AccountsHTML.jsp">
    Billy>    <forward name="accounts" path="/WEB-INF/jsp/AccountsHTML.jsp"/>
    Billy>   </action>
    Billy> Because of some deployment issue, I need to pre-compile the jsp files.  I successfully use the ANT's jspc tag to compile the all the jsp files to java files, then compile them to java files.  However, I cannot make it use the servlet in the forward tag.  I tried to do this (AccountsHTML_jsp is class file of the compiled version of AccountsHTML.jsp), but I get 404 page.
    Billy>   <action path="/accounts" 
    Billy>    type="com.mydomain.AccountsAction"
    Billy>    name="accountsForm"       
    Billy>    validate="false"
    Billy>    input="/WEB-INF/jsp/AccountsHTML.jsp">
    Billy>    <forward name="accounts" path="/WEB-INF/ui/AccountsHTML_jsp"/>
    Billy>   </action>

    Billy> Would anybody knows how can I make this work?

You don't change your "struts-config.xml" at all to use precompiled JSP pages.
You do have to change your "web.xml" file, however, to include the servlet
mappings for the generated servlets.  You also have to include the generated
and compiled servlet class files in your WAR file.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Forward to a servlet

Posted by Billy Ng <kw...@earthlink.net>.
Interesting!  Tell me if I am wrongly interpret your message.  Do you mean I
should deploy the precompiled jsp files to
tomcat/work/standalone/localhost/myApp ?  If not, how does the servlet
container, tomcat, know I have already precompiled the jsp files when the
forward tag points to the jsp files?

Billy Ng

----- Original Message -----
From: "Andrew Hill" <an...@gridnode.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Sunday, December 15, 2002 11:05 PM
Subject: RE: Forward to a servlet


> I thought that even with precompiling you would just point the forward at
> the .jsp file as normal? (Ie: shouldnt need to modify the action stuff in
> struts-config.xml)
>
> -----Original Message-----
> From: Billy Ng [mailto:kwokng@earthlink.net]
> Sent: Monday, December 16, 2002 14:45
> To: Struts Users Mailing List
> Subject: Forward to a servlet
>
>
> Hi folks,
>
> In my Struts app, I am using the Action to call the jsp file.  In the
> struts-config.xml, the action tag looks like this,
>
>   <action path="/accounts"
>    type="com.mydomain.AccountsAction"
>    name="accountsForm"
>    validate="false"
>    input="/WEB-INF/jsp/AccountsHTML.jsp">
>    <forward name="accounts" path="/WEB-INF/jsp/AccountsHTML.jsp"/>
>   </action>
>
> Because of some deployment issue, I need to pre-compile the jsp files.  I
> successfully use the ANT's jspc tag to compile the all the jsp files to
java
> files, then compile them to java files.  However, I cannot make it use the
> servlet in the forward tag.  I tried to do this (AccountsHTML_jsp is class
> file of the compiled version of AccountsHTML.jsp), but I get 404 page.
>
>   <action path="/accounts"
>    type="com.mydomain.AccountsAction"
>    name="accountsForm"
>    validate="false"
>    input="/WEB-INF/jsp/AccountsHTML.jsp">
>    <forward name="accounts" path="/WEB-INF/ui/AccountsHTML_jsp"/>
>   </action>
>
> Would anybody knows how can I make this work?
>
> Thanks in advance!
>
> Billy Ng
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Forward to a servlet

Posted by Andrew Hill <an...@gridnode.com>.
I thought that even with precompiling you would just point the forward at
the .jsp file as normal? (Ie: shouldnt need to modify the action stuff in
struts-config.xml)

-----Original Message-----
From: Billy Ng [mailto:kwokng@earthlink.net]
Sent: Monday, December 16, 2002 14:45
To: Struts Users Mailing List
Subject: Forward to a servlet


Hi folks,

In my Struts app, I am using the Action to call the jsp file.  In the
struts-config.xml, the action tag looks like this,

  <action path="/accounts"
   type="com.mydomain.AccountsAction"
   name="accountsForm"
   validate="false"
   input="/WEB-INF/jsp/AccountsHTML.jsp">
   <forward name="accounts" path="/WEB-INF/jsp/AccountsHTML.jsp"/>
  </action>

Because of some deployment issue, I need to pre-compile the jsp files.  I
successfully use the ANT's jspc tag to compile the all the jsp files to java
files, then compile them to java files.  However, I cannot make it use the
servlet in the forward tag.  I tried to do this (AccountsHTML_jsp is class
file of the compiled version of AccountsHTML.jsp), but I get 404 page.

  <action path="/accounts"
   type="com.mydomain.AccountsAction"
   name="accountsForm"
   validate="false"
   input="/WEB-INF/jsp/AccountsHTML.jsp">
   <forward name="accounts" path="/WEB-INF/ui/AccountsHTML_jsp"/>
  </action>

Would anybody knows how can I make this work?

Thanks in advance!

Billy Ng


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>