cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Micke! Re: calling servlet from XML ?
Date Fri, 15 Sep 2000 19:04:28 GMT

Hello Mike,

Thanks for the reply.  I did see the stuff you mentioned in the archive but
I was hoping to see if it's feasible to control the call from the page
itself (equivalent to server-side includes we do in HTML) for the following
   We have XML pages in our site that contain static and dynamic data.
Some pages may only need to call one servlet to get dynamic data and embed
   it whereas some page require calling different servlets to get different
set of dynamic information.  With the approach you mentioned, I have to
  another servlet to handle these situations and it's not clean.   That's
what I thought the clean way would be to simply acces the XML page itself
and have the
 XML handle the calls to servlet per its needs

 Anyone has run into this problem?  Any other suggestions? etc.

                    Engelhart               To:          
                    <mengelhart@eart        cc:                                       
          >              Subject:     Re: calling servlet from XML ?
                    09/15/2000 09:54                                                     
                    Please respond                                                       
                    to cocoon-users                                                      

> Hello,
> Does anyone know how to call a servlet from an XML file?  In my XML file
> (shown below), I have a section that is static data and a section that is

> dynamic where I want to call a servlet to get data to be inserted in that

> section (my servlet would be outputting XML).  I am assuming that I can
> this via XSP tags but I don't know what the syntax or command is to
> the servlet and get the data.
> <mypage>
>    <static-data>
>       .....
>    </static-data>
>    <dynamic-data>
>        <!-- call servlet to get dynamic XML data to be inserted here -->
>   </dynamic-data>

Your best bet in this situation is to call the servlet first and the use
RequestDispatcher to stuff the data into the request object and forward it

to the XSP page.  Then you can do something like this:

           <xsp:expr>(Element) request.getAttribute

The above syntax depends on if the XML is generated as strings or using

If you're using a string then you'd have to import it.

anyway, i've posted this on the mailing list a couple of times so if you
look at the archives there is a more detailed code example.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message