It doesn't seem to work using setScreenTemplate. Five minutes ago I changed
the method getContent of the JspPortlet and now seems ok.
I'm a new user so I'm not sure about the solution, anyway this is my version
of the method.

    public ConcreteElement getContent( RunData rundata ) {

        String template = "";

        try {

            //
            // gets the jsp page from the xreg configuration
            // NOTE: wouldn't it be better to get the param from the PSML?
            //
            template = getPortletConfig().getInitParameter("template");

            JspService service = (JspService)TurbineServices.getInstance()

.getService(JspService.SERVICE_NAME);
            // this is only necessary if we ddon't run in a JSP page
environment
            // but better be safe than sorry...
            service.addDefaultObjects(rundata);

            // Allow access to portlet from .jsp template
            rundata.getRequest().setAttribute("portlet", this);

            // Add js_peid out of convenience
            rundata.getRequest().setAttribute("js_peid", this.getID());

         // Retrieve and execute the action object
            String actionName =
getPortletConfig().getInitParameter("action");
         if (actionName != null) {
             try {
                    if (Log.getLogger().isDebugEnabled()) {
                        Log.debug("JspPorlet: Executing action [" +
actionName + "] for portlet [" + this.getName() + "]");
                    }
                    ActionLoader.getInstance().exec(rundata, actionName);
                } catch( Exception e) {
                    Log.error(e);
                }
            }

            // Get template name from session.
            if (rundata.getRequest().getAttribute("template") != null){

                template = (String)
rundata.getRequest().getAttribute("template");
            }

            // Moved from the beginning of the method.
            TemplateLocatorService lserv =
(TemplateLocatorService)TurbineServices.getInstance()
                .getService(TemplateLocatorService.SERVICE_NAME);
            String locatedTemplate = lserv.locatePortletTemplate( rundata,

                                                                 template );
            // handle request
            service.handleRequest(rundata, locatedTemplate);

        } catch (Exception e) {
            String message = "JspPortlet: Could not include the following
JSP Page:  " + template + " : " + e.getMessage();
            Log.error( message, e );
            return new StringElement( message );
        }

        return new ElementContainer();
    }


----- Original Message -----
From: "Mark Orciuch" <[EMAIL PROTECTED]>
To: "Jetspeed Users List" <[EMAIL PROTECTED]>
Sent: Tuesday, December 17, 2002 4:55 PM
Subject: RE: JSP & setTemplate...


> Try using rundata.setScreenTemplate.
>
> Best regards,
>
> Mark Orciuch - [EMAIL PROTECTED]
> Jakarta Jetspeed - Enterprise Portal in Java
> http://jakarta.apache.org/jetspeed/
>
> > -----Original Message-----
> > From: Fabio Latrofa [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 17, 2002 3:32 AM
> > To: 'Jetspeed Users List'
> > Subject: JSP & setTemplate...
> >
> >
> > I tried to override the buildMaximizedContext method of
> > JspPortletAction to
> > change the template of a portlet, but it doesn't seem to work; I used
the
> > setTemplate method. Maybe I did something wrong, but the same
> > setTemplate()
> > works fine when called from a generic doUpdate() method. Any suggestion?
> >
> >     public class Test extends JspPortletAction {
> >
> >         public void doUpdate(RunData rundata, Portlet portlet) throws
> > Exception {
> >             setTemplate(rundata, "maximized-test.jsp");
> >         }
> >
> >         protected void buildMaximizedContext(Portlet portlet, RunData
> > rundata)
> >         throws Exception
> >         {
> >             setTemplate(rundata, "maximized-test.jsp");
> >         }
> >     ...
> >     }
> >
> > Best regards,
> >
> > ------------------------------------
> > Fabio Latrofa
> > Siva S.p.A.
> > Viale di Val Fiorita, 86
> > 00144 Roma
> > Tel. +39 0654220452
> > Fax +39 0654220484
> >



Questa e-mail e' stata verificata dal sistema di antivirus della Siva S.P.A.


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

Reply via email to