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 立焰 李 <ll...@yahoo.com.cn> on 2006/03/09 16:54:00 UTC

回复: RE: portletPreference question

I use the distribution jetspeed-2.0-M3-Tomcat-5.5.9.i've never change any web app within this distribution. you see that bookmark portlet locate in app demo.
  BookmarkPortlet is in my computer:
  D:\jetspeed-2.0-M3-Tomcat-5.5.9\jakarta-tomcat-5.5.9\webapps\demo\WEB-INF\classes\org\apache\portals\applications\desktop\BookmarkPortlet.class
I just change something following what i have said.
  Here is BookmarkPortlet code:
  /**
 * BookmarkPortlet
 * 
 * @author <a href="David'>mailto:taylor@apache.org">David Sean Taylor </a>
 * @version $Id: BookmarkPortlet.java,v 1.1 2004/11/19 21:53:12 taylor Exp $
 */
public class BookmarkPortlet extends GenericServletPortlet
{
    public void processAction (ActionRequest request, ActionResponse actionResponse)
        throws PortletException, java.io.IOException 
    {
        String removeName = request.getParameter("remove");     
        if (removeName!=null) 
        { // remove
            PortletPreferences prefs = request.getPreferences();
            prefs.reset(removeName);     
            prefs.store();
        }
        String add = request.getParameter("add");           
        if (add!=null) 
        { // add                     
            PortletPreferences prefs = request.getPreferences();
            prefs.setValue(request.getParameter("name"),                           
                    request.getParameter("value"));     
            prefs.store();                          
        }
    }
}
   
  BookmarkPortlet section in portlet.xml:
  ......
    <portlet>
    <description>Bookmark Portlet</description>
    <portlet-name>BookmarkPortlet</portlet-name>
    <display-name>Bookmark Portlet</display-name>
    <portlet-class>org.apache.portals.applications.desktop.BookmarkPortlet</portlet-class>
    <init-param>
  <name>ViewPage</name>
   <value>/WEB-INF/view/bookmark-view.jsp</value>
     </init-param>   
    <init-param>
  <name>EditPage</name>
   <value>/WEB-INF/view/bookmark-edit.jsp</value>
     </init-param>   
    <init-param>
  <name>HelpPage</name>
   <value>/WEB-INF/view/bookmark-help.jsp</value>
     </init-param>   
    <expiration-cache>0</expiration-cache>            
    <supports>
      <mime-type>text/html</mime-type>                
      <portlet-mode>VIEW</portlet-mode>                
      <portlet-mode>EDIT</portlet-mode>                
      <portlet-mode>HELP</portlet-mode>                
    </supports>                                
    <supported-locale>en</supported-locale>                
    <supported-locale>de</supported-locale>            
    <resource-bundle>org.apache.portals.applications.desktop.resources.Bookmark</resource-bundle>            
    <portlet-preferences>
      <preference>                            
        <name>Jetspeed-2 Site</name>                    
        <value>http://portals.apache.org/jetspeed-2/</value>    
      </preference>                                 
      <preference>                            
        <name>Bluesunrise Site</name>                    
        <value>http://www.bluesunrise.com/</value>    
      </preference>                               
      <preference>                            
        <name>Apache Home</name>                    
        <value>http://www.apache.org/</value>    
      </preference>                                  
    </portlet-preferences>        
  </portlet>
  ....
   
  I use user1 logon jp2.then I add a new PortletPreference pair:the key user1,value user1,not in portlet.xml but using the portlet bookmarkportlet itself .when user2 logon jp2,it can get all what other user have changed within BookmarkPortlet.
  how i understand the conception user. it means account registed in portal system or web page id such as session id. 
  and who can  tell me the relation among  these conception in jp2 : portlet.xml,portletdefinition,portletentity,portletwindow . someone providing some concreate jp2 example is best. 
   
  
"Keshavan, Rango" <ra...@fmr.com> 写道:
  The way it is working for us is we have them in the portlet.xml, which creates a default set of preferences for the user. When we change them per user, it stays that way. When a new user enters the system, the default preferences are copied over for the user. 

I do want to put some code in, though, that would add new preferences on the fly (the JSR spec says it can be done, so I'm presuming it can, haven't tried it yet). I hope those are handled in this fashion. That a new user would only get the defaults that are in the portlet.xml, and NOT get the new ones added for another user...

We shall see!!

----------
Rango Keshavan
617 563 2435


> -----Original Message-----
> From: Aaron Evans [mailto:aaronmevans@gmail.com]
> Sent: Thursday, March 09, 2006 10:05 AM
> To: Jetspeed Users List
> Subject: Re: portletPreference question
> 
> In my case, the preferences are specified in the portlet.xml.
> 
> On 3/9/06, Keshavan, Rango wrote:
> >
> > Do you have the Portlet Preferences specified in the portlet.xml to
> begin
> > with or are you adding them in???
> >
> >
> >
> > ----------
> > Rango Keshavan
> > 617 563 2435
> >
> >
> > > -----Original Message-----
> > > From: Aaron Evans [mailto:aaronmevans@gmail.com]
> > > Sent: Thursday, March 09, 2006 9:58 AM
> > > To: Jetspeed Users List
> > > Subject: Re: portletPreference question
> > >
> > > Holy cow! He's right!
> > >
> > > I just assumed that portlet preferences were stored on a user by user
> > > basis,
> > > but I just tested and they are being treated globally!
> > >
> > > So this is a bug, right?
> > >
> > >
> > >
> > > On 3/9/06, 立焰 李 wrote:
> > > >
> > > > hello,everyone:
> > > > At fist,i change
> > > > 'public-view'
> > > > into
> > > > 'public-edit'
> > > > within file default-page.psml under directory pages/.
> > > > then i new users user1 and user2.
> > > > when i logon jetspeed2 with username user1 role user,i
> > > > add a new bookmark.why user user2 can get it when he
> > > > logon jp2.how do i understand the portletPreference?
> > > > isn't it user-specific in jetspeed2?
> > > > tks!
> > > >
> > > > __________________________________________________
> > > > 赶快注册雅虎超大容量免费邮箱?
> > > > http://cn.mail.yahoo.com
> > > >
> > > > --------------------------------------------------------------------
> -
> > > > To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> > > > For additional commands, e-mail: jetspeed-user-
> help@portals.apache.org
> > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
> > For additional commands, e-mail: jetspeed-user-help@portals.apache.org
> >
> >

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



		
---------------------------------
 雅虎1G免费邮箱百分百防垃圾信
 雅虎助手-搜索、杀毒、防骚扰