You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Firestone <bi...@cisco.com> on 2001/06/21 17:58:23 UTC
ActionServlet.processInclude()
>From an Action class, or perhaps from a subsequent jsp page, I want to include content from generated by another servlet -- a subservlet, if you will -- but the key is that the subservlet is a general resource in the server's servlet environment and should accessible either from within Struts or from outside of Struts.
The javadoc on http://jakarta.apache.org/struts/ has an ActionServlet.processInclude method. But this javadoc looks like it's for Struts 1.1, not 1.0.
Is there a way in Struts 1.0 to invoke (include) another servlet and have it add content to the output? If not, is it possible to "include" another servlet and have it return its content in an attribute so that the caller can include it in the output?
Thanks.
Bill
Re[2]: ActionServlet.processInclude()-Error
Posted by Anthony Xin Chen <xi...@tbcommerce.com>.
Hello B,
Monday, July 30, 2001, 7:35:09 AM, you wrote:
BM> Further to this mail,I tried using the syntax as suggested ,but I get a page
BM> not found error.
BM> My web.xml entry is ...
BM> <!-- Report Servlet -->
BM> <servlet>
BM> <servlet-name>DisplayReportsServlet</servlet-name>
BM> <servlet-class>com.mizuho.rdw.reports.DisplayReportsServlet</servlet-class>
BM> </servlet>
BM> <servlet-mapping>
BM> <servlet-name>DisplayReportsServlet</servlet-name>
BM> <url-pattern>displayReport</url-pattern>
^^^^^^^^^^^^^
Try <url-pattern>/displayReport</url-pattern>
Refer to Servlet Specification for how to map requests to servlets
using web deployment descriptor.
BM> </servlet-mapping>
BM> My struts-config.xml has the following entry..
BM> <!--For saving group details-->
BM> <action path="/groupsSave"
BM> type="com.mizuho.rdw.groups.client.SaveGroupsAction"
BM> name="groupsForm"
BM> scope="request"
BM> validate="false">
BM> <forward name="save" path="/jsp/dataArea.jsp"/>
BM> <forward name="redisplay"
BM> path="/groupsDisplay.do?actionType=New"/>
BM> <forward name="search" path="/jsp/cascadeDisplay.jsp"/>
BM> <forward name="refreshScreen" path="/groupsDisplay.do"/>
BM> <forward name="displayReport" path="/displayReports"/>
BM> </action>
BM> <!-- For display of reports -->
BM> <action path="/displayReports"
BM> forward ="/displayReport">
BM> </action>
BM> But Iam still getting 404 page not found error.What is wrong in my xml
BM> entries ?
BM> Mani
--
Best regards, Anthony
Re: ActionServlet.processInclude()-Error
Posted by B Manikandan <ma...@wipro.com>.
Further to this mail,I tried using the syntax as suggested ,but I get a page
not found error.
My web.xml entry is ...
<!-- Report Servlet -->
<servlet>
<servlet-name>DisplayReportsServlet</servlet-name>
<servlet-class>com.mizuho.rdw.reports.DisplayReportsServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>DisplayReportsServlet</servlet-name>
<url-pattern>displayReport</url-pattern>
</servlet-mapping>
My struts-config.xml has the following entry..
<!--For saving group details-->
<action path="/groupsSave"
type="com.mizuho.rdw.groups.client.SaveGroupsAction"
name="groupsForm"
scope="request"
validate="false">
<forward name="save" path="/jsp/dataArea.jsp"/>
<forward name="redisplay"
path="/groupsDisplay.do?actionType=New"/>
<forward name="search" path="/jsp/cascadeDisplay.jsp"/>
<forward name="refreshScreen" path="/groupsDisplay.do"/>
<forward name="displayReport" path="/displayReports"/>
</action>
<!-- For display of reports -->
<action path="/displayReports"
forward ="/displayReport">
</action>
But Iam still getting 404 page not found error.What is wrong in my xml
entries ?
Mani
"Craig R. McClanahan" wrote:
> On Thu, 21 Jun 2001, Bill Firestone wrote:
>
> > >From an Action class, or perhaps from a subsequent jsp page, I want
> > to include content from generated by another servlet -- a subservlet,
> > if you will -- but the key is that the subservlet is a general
> > resource in the server's servlet environment and should accessible
> > either from within Struts or from outside of Struts.
> >
> > The javadoc on http://jakarta.apache.org/struts/ has an
> > ActionServlet.processInclude method. But this javadoc looks like it's
> > for Struts 1.1, not 1.0.
> >
> > Is there a way in Struts 1.0 to invoke (include) another servlet and
> > have it add content to the output? If not, is it possible to
> > "include" another servlet and have it return its content in an
> > attribute so that the caller can include it in the output?
>
> Support for forward/include is also available in Struts 1.0, as follows:
>
> * You can use your subservlet as an Action itself, by
> forwarding to it:
>
> <action path="/mypath" forward="/mysubservlet" .../>
>
> NOTE: No "type" attribute would be used here.
>
> * You can use your subservlet as an Action itself, by
> including it (you would do this if the subservlet
> expects to be the target of a RequestDispatcher.include()):
>
> <action path="/mypath" include="/mysubservlet" .../>
>
> NOTE: No "type" attribute would be used here.
>
> * You can forward from your Action to a presentation JSP page
> in the usual way, and that JSP page can use <jsp:include>
> to merge in content from the subservlet.
>
> * You can stitch together the output of multiple servlets by
> using RequestDispatcher.include() multiple times in your
> Action, although the previous method (using <jsp:include>)
> would generally be preferred.
>
> See the documentation in struts-config_1_0.dtd for more info about the
> first two options.
>
> >
> > Thanks.
> >
> > Bill
> >
> >
>
> Craig
Re: ActionServlet.processInclude()
Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Thu, 21 Jun 2001, Bill Firestone wrote:
> >From an Action class, or perhaps from a subsequent jsp page, I want
> to include content from generated by another servlet -- a subservlet,
> if you will -- but the key is that the subservlet is a general
> resource in the server's servlet environment and should accessible
> either from within Struts or from outside of Struts.
>
> The javadoc on http://jakarta.apache.org/struts/ has an
> ActionServlet.processInclude method. But this javadoc looks like it's
> for Struts 1.1, not 1.0.
>
> Is there a way in Struts 1.0 to invoke (include) another servlet and
> have it add content to the output? If not, is it possible to
> "include" another servlet and have it return its content in an
> attribute so that the caller can include it in the output?
Support for forward/include is also available in Struts 1.0, as follows:
* You can use your subservlet as an Action itself, by
forwarding to it:
<action path="/mypath" forward="/mysubservlet" .../>
NOTE: No "type" attribute would be used here.
* You can use your subservlet as an Action itself, by
including it (you would do this if the subservlet
expects to be the target of a RequestDispatcher.include()):
<action path="/mypath" include="/mysubservlet" .../>
NOTE: No "type" attribute would be used here.
* You can forward from your Action to a presentation JSP page
in the usual way, and that JSP page can use <jsp:include>
to merge in content from the subservlet.
* You can stitch together the output of multiple servlets by
using RequestDispatcher.include() multiple times in your
Action, although the previous method (using <jsp:include>)
would generally be preferred.
See the documentation in struts-config_1_0.dtd for more info about the
first two options.
>
> Thanks.
>
> Bill
>
>
Craig