Mark:
Thank you. I hope this works. I didn't try it out yet. But in the meantime I
found another solution:
Inside of the JSP page you have to call out.flush() before making subsequent
calls to other potential JSP objects (portlets, controls, controller)
So my code is this:
out.flush();
out.println( thePortlet.getContent( theRunData ) );
I have a question to your explanation concerning getContent():
What is the former way of aggregation and what is the current way of
aggregation?
Is this correct:
formerly: use of PrintWriter
now: return a String
best regards
Matt
> -----Original Message-----
> From: Mark Orciuch [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 11, 2002 11:17 AM
> To: Jetspeed Users List
> Subject: RE: JSP and Jetspeed
>
>
> Matthias,
>
> The reason getContent does not return anything is because it
> writes directly
> to the output stream (see service.handleRequest call). I have
> a modified
> version of JspPortlet which can either display portlet
> located by name or by
> its physical location. The 2nd case illustrates returning the
> jsp content
> rather than writing directly to output stream - this is how
> it used to be
> done in prior release of Jetspeed.
>
> Here's the code:
> ==============================================================
> ==============
> ==============================================================
> public ConcreteElement getContent(RunData rundata )
> {
>
> try {
>
> // Build parameter list to be passed with the jsp
> Iterator names =
> this.getPortletConfig().getInitParameterNames();
> StringBuffer parms = new StringBuffer();
> if (names.hasNext()) {
> parms.append("?");
> }
> while (names.hasNext()) {
> String name = (String)names.next();
> String value =
> (String)getPortletConfig().getInitParameter(name);
> parms.append(name).append("=").append(value);
> if (names.hasNext()) {
> parms.append("&");
> }
> }
>
> // Add jsp tools
> HttpServletRequest req = rundata.getRequest();
> req.setAttribute(JspService.LINK, new JspLink(rundata));
> req.setAttribute(JspService.RUNDATA, rundata);
> req.setAttribute("portlet", this.getName());
>
> // Retrieve the URL
> PortletEntry pe =
> (PortletEntry)Registry.getEntry(Registry.PORTLET, this.getName());
> String jsp = pe.getURL();
>
> // Files referenced from default templates folder will be
> processed
> // using JspService. Otherwise, they will be loaded using
> EcsServletElement
> // from where ever they came from (for example,
> "/WEB-INF/templates/jsp/screens/html/some.jsp").
> if (jsp.startsWith("/template/")) {
> JspService jserv =
> (JspService)TurbineServices.getInstance().getService(JspServic
> e.SERVICE_NAME
> );
> TemplateLocatorService lserv =
> (TemplateLocatorService)TurbineServices.
>
> getInstance().getService(TemplateLocatorService.SERVICE_NAME);
>
> String template = jsp.substring(10);
>
> //we use the template locator service to translate the
> template
> String locatedTemplate =
> lserv.locatePortletTemplate(rundata, template);
> Log.debug("JspServerPortlet: located portlet
> template = " +
> locatedTemplate);
> if (locatedTemplate == null) {
> locatedTemplate =
> lserv.locateScreenTemplate(rundata,
> template);
> if (locatedTemplate != null) {
> locatedTemplate = "/screens" +
> locatedTemplate;
> }
> Log.debug("JspServerPortlet: located
> screen template = "
> + locatedTemplate);
> }
>
> // this is only necessary if we ddon't run in
> a JSP page
> environment
> // but better be safe than sorry...
> jserv.addDefaultObjects(rundata);
>
> // handle request
> jserv.handleRequest(rundata, locatedTemplate);
>
> return new ElementContainer();
> } else {
> return new EcsServletElement(rundata, jsp +
> parms.toString());
> }
>
> } catch (Exception e) {
> Log.error(e);
> return new
> StringElement(myPortalResources.MSG_TEMPORARILY_UNAVAILBLE);
> }
> }
> ==============================================================
> ==============
> =============================================================
>
> Hope this helps. Incidentally, writing a JSP base controller
> is on my long
> list of todo's. Would be willing to share that code? I'm sure
> other JSP
> developers on this list would benefit as well. Thanks!
>
> Best regards,
>
> Mark C. Orciuch
> IT Consultant
> Voice: 219-647-4122
> e-Mail: [EMAIL PROTECTED]
>
> -----Original Message-----
> From: Wimmer, Matthias [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 8:33 PM
> To: 'Jetspeed Users List'
> Subject: JSP and Jetspeed
>
>
> Hi,
>
> my goal is the improvement of Jetspeed with respect to the
> JSP templates.
> Unfortunately I am a beginner in all this stuff:
>
> - calls to JSP templates
> - their integration to the process of aggregation
> - ...
>
> My first step was to write a control using JSP. I succeeded
> but there are
> still a few problems.
>
> There is also a problem with the pre-implemented JSPPortlet's
> method with
> the name getContent(). It results with an empty string, but
> the content of
> the page appears anyway.
>
> How is this done by the JSPPortlet? This is not the usual
> behavior, is it?
> How can this be fixed?
>
>
> best regards
>
> Matthias Wimmer
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>