Hello, thanks for answer

Yes I have also declared this part in my portlet.xml

                <supports>
                        <mime-type>text/html</mime-type>
                        <portlet-mode>edit</portlet-mode>
                        <portlet-mode>help</portlet-mode>
                        <portlet-mode>about</portlet-mode>
                        <portlet-mode>print</portlet-mode>
                </supports>

Then I add 

                <custom-portlet-mode>
                        <description>Mode pour indiquer l'auteur de la portlet 
par exemple</description>
                        <name>about</name>
                </custom-portlet-mode>

                <custom-portlet-mode>
                        <description>Mode pour l'impression</description>
                        <name>print</name>
                </custom-portlet-mode> 

But is it enough?  Because when I test the supported mode in doView

                Enumeration modeEnum = 
request.getPortalContext().getSupportedPortletModes();
                writer.write("<p>Modes <br />");
                while (modeEnum.hasMoreElements()) {
                        PortletMode pMode = (PortletMode) 
modeEnum.nextElement();
                        PortletURL modeUrl = response.createRenderURL();
                        modeUrl.setPortletMode(pMode);
                        writer.write("<li> <a href=\"" + modeUrl.toString() + 
"\">" + pMode + "</a></li>");
                }
                writer.write("</p>");

I didn't retrieve my custom mode. 

My error appears when I tried to create a link on it :  
javax.portlet.PortletModeException: unsupported Portlet Mode used: print

                PortletURL printModeUrl = response.createRenderURL();
                printModeUrl.setPortletMode(PRINT);


I have exactly the same probleme on Jboss and Jetspeed.

Thanks for your help.

Nicolas

Nicolas LAFAURY
Smile- Motoriste Internet
01-41-40-11-05
[EMAIL PROTECTED]
 

-----Message d'origine-----
De : Ate Douma [mailto:[EMAIL PROTECTED] 
Envoyé : jeudi 6 avril 2006 09:34
À : [email protected]
Objet : Re: Problem with custom mode

Nicolas Lafaury wrote:
> Hello
> 
> I use uPortal that use pluto to run portlet.
> 
> I am trying to build custom mode in my portlet, but I have an error.
> 
> In portlet.xml, I add
> 
> *<custom-portlet-mode>*
> 
> *<description>Mode pour l'impression</description>*
> 
> *<name>print</name>*
> 
> *</custom-portlet-mode>*
> 
> In my *"public class ExemplePortlet extends GenericPortlet {"*, I add, 
> as I see on the forum,
> 
> public final static PortletMode PRINT =3D new PortletMode("print");
> 
> but when I tried to create a link to this custom mode, I have an error : 
> /javax.portlet.PortletModeException: unsupported Portlet Mode used: 
> print/
> 
> Do I need to do something else to create my own custom mode?
I don't know what other restrictions uPortal might have, but one thing you at 
least need to do is specifying your portlet actually supports it.
Like:

   <portlet>
     ...
     <supports>
       <mime-type>text/html</mime-type>
       <portlet-mode>print</portlet-mode>
     </supports>
     ...
   </portlet>

> 
> thanks for your help.
> 
> Nicolas
> 
>  
> Nicolas LAFAURY
> Smile- Motoriste Internet
> 01-41-40-11-05
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
>  
>  

Reply via email to