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 tr...@excite.it on 2003/10/30 11:34:52 UTC

One Panel with 3 JSP Portlets

I have a panel with 3 portlet (a,b,c), every portlet is a very simple jsp
portlet which use org.apache.jetspeed.portal.portlets.JspPortlet
and its action class (JspPortletActionA,JspPortletActionB,JspPortletActionC)

Example of portletb.xreg

<?xml version="1.0" encoding="UTF-8"?>
<registry>
    <portlet-entry name="portletb" hidden="false" type="ref"
        parent="JSP" application="false">
        <meta-info>
            <title>Prova JSP B</title>
            <description>esempio di applicazione jsp B</description>
        </meta-info>
        <classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
        <parameter name="template" value="portletb/b.jsp"
            hidden="false" cachedOnName="true" cachedOnValue="true"/>
        <parameter name="action"
            value="portlets.JspPortletActionB" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <media-type ref="html"/>
        <url cachedOnURL="true"/>
    </portlet-entry>
</registry>

a,b,c jsp contain a form like this

Example b.jsp 

<form method="post" action="<jetspeed:dynamicUri/>">
<input type="hidden" name="js_peid" value="<%=jspeid%>">
Insert your name: <INPUT TYPE=TEXT NAME=username SIZE=20>
<P>
<input type="submit" name="eventSubmit_doDetailsb" value="Save"/>
</form>


Example JspPortletActionB

public class JspPortletActionB extends JspPortletAction  {

    public void buildNormalContext(Portlet portlet, RunData rundata)
    {
    }
    public void doDetailsb(RunData data, Portlet portlet) throws Exception
    {
        setTemplate(data, "ContactB.jsp");
    }

}

When I click the submit in one of the 3 portlet there is a refresh of the
page of the portal and all portlets in a page (panel) are going to actionClass
all the time! Is possible to refresh only the portlet where I click the
submit without influence
other jsp portlet in the same panel? Can you post some code to adjust this
problem?
[What I want to do is :
a form in a portletA where user insert some data and he submit ,
then a new jsp page is load with data inserted in portletA. After when user
insert data in portletB and there is a submit i dont want to loose the jsp
page loaded in portletA]

I hope that what I have written is clear, excused for my bad English :-)
thanks in advance to anyone answers to me.






__________________________________________________________________
Accesso Internet Gratis per utenti Excite! Attivalo subito!
http://www.excite.it/hitech/accesso

Il Mio Excite. Personalizza la tua Home page Excite come vuoi tu!
http://www.excite.it

AAA/Relazioni. Sfoglia gli annunci e trova la tua anima gemella
http://www.excite.it/relazioni




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: One Panel with 3 JSP Portlets

Posted by Todd Kuebler <tk...@cisco.com>.
Also, if your action is shared between different portlets (possible due to 
mvcportlet implementation) and you want your action to only act on one 
portlet you must set the 'js_peid' as a variable in your form so the 
jetspeed system knows the portlet you are targeting (usually a good idea 
anyway).

A common way to keep data persistent across requests is to put it in the 
session and then check the session for it during your 
buildNormalContext.  That way unless the data is changing you can keep it 
persistant during requests without going to the database for it every 
time.  Then, if you specifically call another method via the 
eventSubmit_doBlah mechanism, you can get the new data, replace it in the 
session, then call buildNormalContext to populate the context with it.

-tk

At 12:45 PM 10/30/2003 +0100, Stefan Kuhn wrote:
>Hi,
>you actually encountered a common problem which is due to a misunderstanding:
>Portlets only exist on the server side, for the browser it's just one html
>page and therefore you can't refresh a single portlet. Always the whole page
>is sent to the server and all portlet classes are executed. If you want only
>one portlet to react, you need to have different action parameters in them
>(you always have eventSubmit_doDetailsb, right?). You need to understand that
>a portlet is not a frame, which is a client-side concept.
>HTH
>Stefan
>
>Am Thursday 30 October 2003 11:34 schrieb troppfigo@excite.it:
> > I have a panel with 3 portlet (a,b,c), every portlet is a very simple jsp
> > portlet which use org.apache.jetspeed.portal.portlets.JspPortlet
> > and its action class
> > (JspPortletActionA,JspPortletActionB,JspPortletActionC)
> >
> > Example of portletb.xreg
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <registry>
> >     <portlet-entry name="portletb" hidden="false" type="ref"
> >         parent="JSP" application="false">
> >         <meta-info>
> >             <title>Prova JSP B</title>
> >             <description>esempio di applicazione jsp B</description>
> >         </meta-info>
> >
> > <classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
> > <parameter name="template" value="portletb/b.jsp"
> >             hidden="false" cachedOnName="true" cachedOnValue="true"/>
> >         <parameter name="action"
> >             value="portlets.JspPortletActionB" hidden="true"
> >             cachedOnName="true" cachedOnValue="true"/>
> >         <media-type ref="html"/>
> >         <url cachedOnURL="true"/>
> >     </portlet-entry>
> > </registry>
> >
> > a,b,c jsp contain a form like this
> >
> > Example b.jsp
> >
> > <form method="post" action="<jetspeed:dynamicUri/>">
> > <input type="hidden" name="js_peid" value="<%=jspeid%>">
> > Insert your name: <INPUT TYPE=TEXT NAME=username SIZE=20>
> > <P>
> > <input type="submit" name="eventSubmit_doDetailsb" value="Save"/>
> > </form>
> >
> >
> > Example JspPortletActionB
> >
> > public class JspPortletActionB extends JspPortletAction  {
> >
> >     public void buildNormalContext(Portlet portlet, RunData rundata)
> >     {
> >     }
> >     public void doDetailsb(RunData data, Portlet portlet) throws Exception
> >     {
> >         setTemplate(data, "ContactB.jsp");
> >     }
> >
> > }
> >
> > When I click the submit in one of the 3 portlet there is a refresh of the
> > page of the portal and all portlets in a page (panel) are going to
> > actionClass all the time! Is possible to refresh only the portlet where I
> > click the submit without influence
> > other jsp portlet in the same panel? Can you post some code to adjust this
> > problem?
> > [What I want to do is :
> > a form in a portletA where user insert some data and he submit ,
> > then a new jsp page is load with data inserted in portletA. After when user
> > insert data in portletB and there is a submit i dont want to loose the jsp
> > page loaded in portletA]
> >
> > I hope that what I have written is clear, excused for my bad English :-)
> > thanks in advance to anyone answers to me.
> >
> >
> >
> >
> >
> >
> > __________________________________________________________________
> > Accesso Internet Gratis per utenti Excite! Attivalo subito!
> > http://www.excite.it/hitech/accesso
> >
> > Il Mio Excite. Personalizza la tua Home page Excite come vuoi tu!
> > http://www.excite.it
> >
> > AAA/Relazioni. Sfoglia gli annunci e trova la tua anima gemella
> > http://www.excite.it/relazioni
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org
>
>--
>Stefan Kuhn M. A.
>Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
>Zülpicher Str. 47, 50674 Cologne
>Tel: +49(0)221-470-7428   Fax: +49 (0) 221-470-7786
>My public PGP key is available at http://pgp.mit.edu
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


Re: One Panel with 3 JSP Portlets

Posted by Stefan Kuhn <st...@uni-koeln.de>.
Hi,
you actually encountered a common problem which is due to a misunderstanding: 
Portlets only exist on the server side, for the browser it's just one html 
page and therefore you can't refresh a single portlet. Always the whole page 
is sent to the server and all portlet classes are executed. If you want only 
one portlet to react, you need to have different action parameters in them 
(you always have eventSubmit_doDetailsb, right?). You need to understand that 
a portlet is not a frame, which is a client-side concept.
HTH
Stefan

Am Thursday 30 October 2003 11:34 schrieb troppfigo@excite.it:
> I have a panel with 3 portlet (a,b,c), every portlet is a very simple jsp
> portlet which use org.apache.jetspeed.portal.portlets.JspPortlet
> and its action class
> (JspPortletActionA,JspPortletActionB,JspPortletActionC)
>
> Example of portletb.xreg
>
> <?xml version="1.0" encoding="UTF-8"?>
> <registry>
>     <portlet-entry name="portletb" hidden="false" type="ref"
>         parent="JSP" application="false">
>         <meta-info>
>             <title>Prova JSP B</title>
>             <description>esempio di applicazione jsp B</description>
>         </meta-info>
>        
> <classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
> <parameter name="template" value="portletb/b.jsp"
>             hidden="false" cachedOnName="true" cachedOnValue="true"/>
>         <parameter name="action"
>             value="portlets.JspPortletActionB" hidden="true"
>             cachedOnName="true" cachedOnValue="true"/>
>         <media-type ref="html"/>
>         <url cachedOnURL="true"/>
>     </portlet-entry>
> </registry>
>
> a,b,c jsp contain a form like this
>
> Example b.jsp
>
> <form method="post" action="<jetspeed:dynamicUri/>">
> <input type="hidden" name="js_peid" value="<%=jspeid%>">
> Insert your name: <INPUT TYPE=TEXT NAME=username SIZE=20>
> <P>
> <input type="submit" name="eventSubmit_doDetailsb" value="Save"/>
> </form>
>
>
> Example JspPortletActionB
>
> public class JspPortletActionB extends JspPortletAction  {
>
>     public void buildNormalContext(Portlet portlet, RunData rundata)
>     {
>     }
>     public void doDetailsb(RunData data, Portlet portlet) throws Exception
>     {
>         setTemplate(data, "ContactB.jsp");
>     }
>
> }
>
> When I click the submit in one of the 3 portlet there is a refresh of the
> page of the portal and all portlets in a page (panel) are going to
> actionClass all the time! Is possible to refresh only the portlet where I
> click the submit without influence
> other jsp portlet in the same panel? Can you post some code to adjust this
> problem?
> [What I want to do is :
> a form in a portletA where user insert some data and he submit ,
> then a new jsp page is load with data inserted in portletA. After when user
> insert data in portletB and there is a submit i dont want to loose the jsp
> page loaded in portletA]
>
> I hope that what I have written is clear, excused for my bad English :-)
> thanks in advance to anyone answers to me.
>
>
>
>
>
>
> __________________________________________________________________
> Accesso Internet Gratis per utenti Excite! Attivalo subito!
> http://www.excite.it/hitech/accesso
>
> Il Mio Excite. Personalizza la tua Home page Excite come vuoi tu!
> http://www.excite.it
>
> AAA/Relazioni. Sfoglia gli annunci e trova la tua anima gemella
> http://www.excite.it/relazioni
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org

-- 
Stefan Kuhn M. A.
Cologne University BioInformatics Center (http://www.cubic.uni-koeln.de)
Zülpicher Str. 47, 50674 Cologne
Tel: +49(0)221-470-7428   Fax: +49 (0) 221-470-7786
My public PGP key is available at http://pgp.mit.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


RE: One Panel with 3 JSP Portlets

Posted by Pramod Jain <pr...@indent.org>.
The problem you seem to be having is with caching of JSP pages.  To "submit"
only one page and retrieve the other two from cache you may want to look at
this message I posted

http://www.mail-archive.com/jetspeed-user@jakarta.apache.org/msg09847.html

It is extremely simple to implement.

pramod

-----Original Message-----
From: troppfigo@excite.it [mailto:troppfigo@excite.it]
Sent: Thursday, October 30, 2003 5:35 AM
To: jetspeed-user@jakarta.apache.org
Subject: One Panel with 3 JSP Portlets


I have a panel with 3 portlet (a,b,c), every portlet is a very simple jsp
portlet which use org.apache.jetspeed.portal.portlets.JspPortlet
and its action class (JspPortletActionA,JspPortletActionB,JspPortletActionC)

Example of portletb.xreg

<?xml version="1.0" encoding="UTF-8"?>
<registry>
    <portlet-entry name="portletb" hidden="false" type="ref"
        parent="JSP" application="false">
        <meta-info>
            <title>Prova JSP B</title>
            <description>esempio di applicazione jsp B</description>
        </meta-info>

<classname>org.apache.jetspeed.portal.portlets.JspPortlet</classname>
        <parameter name="template" value="portletb/b.jsp"
            hidden="false" cachedOnName="true" cachedOnValue="true"/>
        <parameter name="action"
            value="portlets.JspPortletActionB" hidden="true"
            cachedOnName="true" cachedOnValue="true"/>
        <media-type ref="html"/>
        <url cachedOnURL="true"/>
    </portlet-entry>
</registry>

a,b,c jsp contain a form like this

Example b.jsp

<form method="post" action="<jetspeed:dynamicUri/>">
<input type="hidden" name="js_peid" value="<%=jspeid%>">
Insert your name: <INPUT TYPE=TEXT NAME=username SIZE=20>
<P>
<input type="submit" name="eventSubmit_doDetailsb" value="Save"/>
</form>


Example JspPortletActionB

public class JspPortletActionB extends JspPortletAction  {

    public void buildNormalContext(Portlet portlet, RunData rundata)
    {
    }
    public void doDetailsb(RunData data, Portlet portlet) throws Exception
    {
        setTemplate(data, "ContactB.jsp");
    }

}

When I click the submit in one of the 3 portlet there is a refresh of the
page of the portal and all portlets in a page (panel) are going to
actionClass
all the time! Is possible to refresh only the portlet where I click the
submit without influence
other jsp portlet in the same panel? Can you post some code to adjust this
problem?
[What I want to do is :
a form in a portletA where user insert some data and he submit ,
then a new jsp page is load with data inserted in portletA. After when user
insert data in portletB and there is a submit i dont want to loose the jsp
page loaded in portletA]

I hope that what I have written is clear, excused for my bad English :-)
thanks in advance to anyone answers to me.






__________________________________________________________________
Accesso Internet Gratis per utenti Excite! Attivalo subito!
http://www.excite.it/hitech/accesso

Il Mio Excite. Personalizza la tua Home page Excite come vuoi tu!
http://www.excite.it

AAA/Relazioni. Sfoglia gli annunci e trova la tua anima gemella
http://www.excite.it/relazioni




---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-user-help@jakarta.apache.org