[opencms-dev] How to include results of a webservice call into a JSP that generates an opencms 8.0.0 page?

Enrico Ballarin Dolfin enrico at sed.ethz.ch
Fri Jul 20 11:44:38 CEST 2012


Hi,

I'm looking for a way to include results of a webservice call into a JSP that 
generates an OpenCms 8.0.0 page.


The webservice calls can returns a PNG image, a text, an XML file, etc, that 
is stored in a DB table as blob field.


For the webservice call I'm using a syntax similar to this:

/MyServices/GetPngBlob?parameter=...
/MyServices/GetXmlBlob?parameter=...
/MyServices/GetTextBlob?parameter=...


While this approach works well for PNG images, e.g.

<p><img src="/MyServices/GetPngBlob?param2=<%= value %>" /></p>

I'm having problems to use the GetTextBlob and the GetXmlBlob service:
I need to call the service and to store the result of the service call in a 
JSP variable (e.g. String data) and then to display it in HTML:

<p><%= data %></p>


The JSP that I use to generate the page has a structure like this and uses a 
bean that I have programmed in Java to be able to access an other DB:

-------------------------------------------------
<%@page buffer="none" session="false" taglibs="c,cms"
    import="java.util.*,org.apache.log4j.*,mypackage.opencms.v8.dbtable.*" %>

<%=
    // create the bean and the other needed objects
    DBTableJspTemplate dbtable = new DBTableJspTemplate(pageContext, request, 
response);

    String param1 = request.getParameter("param1");
...
...

%>

<cms:formatter var="content" val="value">

<div class="dbtable">

...
...

</div>

</cms:formatter>
-------------------------------------------------


Any idea how can I perform the webservice call inside my JSP ?

Many thanks
Enrico



More information about the opencms-dev mailing list