At our company we have multiple teams developing different
applications, and each team will include components from other teams
in their web pages.

Our goal is to include Actions (e.g. "NewsFeed.do") as components on
a web page. We want to include Actions and allow the ActionForm to do
validation for us. And we also want to use Action mappings as use the
struts-config.xml to control the flow of the components.

At first I thought I can do something like this:


  // Display header
  <jsp:include page="/Header.do" />

    // Perhaps some kind of news feed
    <jsp:include page="/NewsFeed.do" />

   // ... so on

Things didn't behave as I had expected. The first include showed up
just fine. However, the rest of the html on the page did not show up.

Looking at the sources, I realized that the ActionServlet uses
'RequestDispatcher.forward' to pass the control on to the next
Action. If I was to change the ActionServlet to use
'RequestDispatcher.include' then each Action is included the way I
expect. 

As a solution, I thought we can use a custom ActionServlet, mapped to
a different extension to do 'includes' and use the normal Servlet
(mapped to .do) for normal flow control. 

Is this a good enough solution for what we want to do? Or is this a
half-baked hack? Has anyone had similar problems trying to include
components while using struts? The document suggested using templates,
tiles and jsp:include, these methods work fine for jsps and htmls, but
including an Action (which calls a RequestDispatcher.forward) flushes
the output stream and stops further includes. Using the bean taglib is
another option, but the bean tag actually makes a HTTP connection
back to the server to fetch the content of the components, which is
inefficient.

I did look on Google and saw a reference to this
problem, and someone had recommended customizing the ActionServlet in the
same way. It seems like a workable solution. Can anyone shed some
lights on the pros and cons of this approach? I appreciate your help,
thanks.

-- 
jc

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to