IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Renderer WM7 Portal SP2

    Posted Wed May 23, 2007 01:25 PM

    Hi,

    I am currently working with Renderers on WM7 Portal SP2. I was able to make a custom Renderer for several JSF UI Component.

    Now, what I am trying to do is to delegate some rendering to the default Renderer. I tried to do that based on this article from Sun :

    This is my code:

    #####################CODE########################

    package com.emergis.pnp.portal.renderer_portlet;

    import java.io.IOException;

    import javax.faces.component.UIComponent;
    import javax.faces.context.FacesContext;
    import javax.faces.render.Renderer;

    public class ButtonRenderer extends Renderer{

    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    
    Renderer baseRenderer = context.getRenderKit().getRenderer("javax.faces.Command", "javax.faces.Button");
    baseRenderer.encodeEnd(context, component);
    
    }
    
    @Override
    public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
    
    
    Renderer baseRenderer = context.getRenderKit().getRenderer("javax.faces.Command", "javax.faces.Button");
    baseRenderer.encodeBegin(context, component);
    }
    

    }

    #####################CODE########################

    After deployment, I get this error after loading the portlet :

    • [POP.001.0002] A “javax.portlet.PortletException” occurred with the Message “at com.webMethods.caf.faces.portlet.FacesPortlet.render(FacesPortlet.java:408)”
    • java.lang.StackOverflowError

    I know that I get this error because I am calling recursively encodeBegin() and encodeEnd(). Base on this, is there another way to delegate the rendering to the default renderer?

    Thanks,

    Paul


    #MWS-CAF-Task-Engine
    #webMethods-BPMS
    #webMethods


  • 2.  RE: Renderer WM7 Portal SP2

    Posted Tue May 29, 2007 03:02 PM

    Hi,

    I found out where my exception comes from. It is because I am overriding the default renderer of javax.faces.Button and my renderer becomes the base renderer. So when I call it, it calls itself recursively. This is why there is a stack overflow.

    Although I understand what causes this exception, my problem is still unsolved.

    How can I create a custom renderer in WM7 basing on the default renderer of the component without overriding it?

    I am able to create a custom renderer in a JSF webapp by creating a Tag class, with a new component type, and use the tags inside my JSP file (cannot be done inside a WM7 .view file). How can I accomplish this in WM7?

    Thank you and hope to hear from someone soon!

    Paul


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 3.  RE: Renderer WM7 Portal SP2

    Posted Wed June 06, 2007 02:27 PM

    Hi,

    I still have no clue how I could do this. (to create a custom renderer in WM7 basing on the default renderer of a component) Any help?

    Thanks


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 4.  RE: Renderer WM7 Portal SP2

    Posted Tue July 10, 2007 01:40 PM

    MWS 7 does not support visual editing with custom components/renderers. However, if you register your custom components/renderers in your webapp’s faces-config.xml file, you can manually edit .view files to use your custom components/renderers.

    For example, if you edit a .view file with a CommandButton control, you’ll see something like this:

    You can replace the “renderer-type” attribute value with the renderer type of a renderer you registered in your faces-config.xml. You can also add arbitrary property elements to specify arbitrary component attributes which your custom renderer may use:

    In your custom renderer encodeBegin() or encodeEnd() method, you could access the “myCustomAttribute” attribute via the following code:

    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
    Object myCustomAttribute = component.getAttributes().get(“myCustomAttribute”);
    // …
    }


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 5.  RE: Renderer WM7 Portal SP2

    Posted Tue July 10, 2007 01:46 PM

    Sorry, you’ll have to find the above post in the html page source to see the .view file xml snippets.


    #webMethods
    #MWS-CAF-Task-Engine
    #webMethods-BPMS