You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Fabio Latrofa <fl...@sivaspa.com> on 2002/12/17 10:32:05 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JSP & setTemplate...

Posted by Fabio Latrofa <fl...@sivaspa.com>.
Thanks anyway. I'm just trying to solve the problem changing JspPortlet
class...

----- Original Message -----
From: "Raffaele Ragni" <ra...@cone.it>
To: "Jetspeed Users List" <je...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 3:11 PM
Subject: Re: JSP & setTemplate...


> Sorry, i don't have any other suggestions
>
>
> ----- Original Message -----
> From: "Fabio Latrofa" <fl...@sivaspa.com>
> To: "Jetspeed Users List" <je...@jakarta.apache.org>
> Sent: Tuesday, December 17, 2002 11:11 AM
> Subject: Re: JSP & setTemplate...
>
>
> > I noticed the Context parameter in buildMaximizedContext of
> > VelocityPortletAction class, but I think it's only for Velocity
templates
> (I
> > didn't find it inside JspPortletAction class).
> >
> >
> > ----- Original Message -----
> > From: "Raffaele Ragni" <ra...@cone.it>
> > To: "Jetspeed Users List" <je...@jakarta.apache.org>
> > Sent: Tuesday, December 17, 2002 10:44 AM
> > Subject: Re: JSP & setTemplate...
> >
> >
> > > As i remember, the buildMaximizedContext had three parameters,
rundata,
> > > context and portlet, probably it is that? (i see context missing, but
> > > probably it works differently with jsp)
> > >
> > >
> > > ----- Original Message -----
> > > From: "Fabio Latrofa" <fl...@sivaspa.com>
> > > To: "'Jetspeed Users List'" <je...@jakarta.apache.org>
> > > Sent: Tuesday, December 17, 2002 10:32 AM
> > > 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:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
> Questa e-mail e' stata verificata dal sistema di antivirus della Siva
S.P.A.
>


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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JSP & setTemplate...

Posted by Raffaele Ragni <ra...@cone.it>.
Sorry, i don't have any other suggestions


----- Original Message -----
From: "Fabio Latrofa" <fl...@sivaspa.com>
To: "Jetspeed Users List" <je...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 11:11 AM
Subject: Re: JSP & setTemplate...


> I noticed the Context parameter in buildMaximizedContext of
> VelocityPortletAction class, but I think it's only for Velocity templates
(I
> didn't find it inside JspPortletAction class).
>
>
> ----- Original Message -----
> From: "Raffaele Ragni" <ra...@cone.it>
> To: "Jetspeed Users List" <je...@jakarta.apache.org>
> Sent: Tuesday, December 17, 2002 10:44 AM
> Subject: Re: JSP & setTemplate...
>
>
> > As i remember, the buildMaximizedContext had three parameters, rundata,
> > context and portlet, probably it is that? (i see context missing, but
> > probably it works differently with jsp)
> >
> >
> > ----- Original Message -----
> > From: "Fabio Latrofa" <fl...@sivaspa.com>
> > To: "'Jetspeed Users List'" <je...@jakarta.apache.org>
> > Sent: Tuesday, December 17, 2002 10:32 AM
> > 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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JSP & setTemplate...

Posted by Fabio Latrofa <fl...@sivaspa.com>.
I noticed the Context parameter in buildMaximizedContext of
VelocityPortletAction class, but I think it's only for Velocity templates (I
didn't find it inside JspPortletAction class).


----- Original Message -----
From: "Raffaele Ragni" <ra...@cone.it>
To: "Jetspeed Users List" <je...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 10:44 AM
Subject: Re: JSP & setTemplate...


> As i remember, the buildMaximizedContext had three parameters, rundata,
> context and portlet, probably it is that? (i see context missing, but
> probably it works differently with jsp)
>
>
> ----- Original Message -----
> From: "Fabio Latrofa" <fl...@sivaspa.com>
> To: "'Jetspeed Users List'" <je...@jakarta.apache.org>
> Sent: Tuesday, December 17, 2002 10:32 AM
> 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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JSP & setTemplate...

Posted by Raffaele Ragni <ra...@cone.it>.
As i remember, the buildMaximizedContext had three parameters, rundata,
context and portlet, probably it is that? (i see context missing, but
probably it works differently with jsp)


----- Original Message -----
From: "Fabio Latrofa" <fl...@sivaspa.com>
To: "'Jetspeed Users List'" <je...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 10:32 AM
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:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: JSP & setTemplate...

Posted by Fabio Latrofa <fl...@sivaspa.com>.
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" <ma...@ngsltd.com>
To: "Jetspeed Users List" <je...@jakarta.apache.org>
Sent: Tuesday, December 17, 2002 4:55 PM
Subject: RE: JSP & setTemplate...


> Try using rundata.setScreenTemplate.
>
> Best regards,
>
> Mark Orciuch - morciuch@apache.org
> Jakarta Jetspeed - Enterprise Portal in Java
> http://jakarta.apache.org/jetspeed/
>
> > -----Original Message-----
> > From: Fabio Latrofa [mailto:flatrofa@sivaspa.com]
> > 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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: JSP & setTemplate...

Posted by Mark Orciuch <ma...@ngsltd.com>.
Try using rundata.setScreenTemplate.

Best regards,

Mark Orciuch - morciuch@apache.org
Jakarta Jetspeed - Enterprise Portal in Java
http://jakarta.apache.org/jetspeed/

> -----Original Message-----
> From: Fabio Latrofa [mailto:flatrofa@sivaspa.com]
> 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:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>