Thanks Thijs!

I also found another example that works sitting in the Wicket SVN repo:

https://svn.apache.org/repos/asf/wicket/trunk/wicket-examples/src/main/java/org/apache/wicket/examples/portlet/menu/

Basically all I needed to do was add the init-params to my portlet.xml (in
addition to the standard portlet-mode bits):

    <init-param>
      <name>viewPage</name>
      <value>/customModes/view</value>
    </init-param>
    <init-param>
      <name>editPage</name>
      <value>/customModes/edit</value>
    </init-param>
    <init-param>
      <name>helpPage</name>
      <value>/customModes/help</value>
    </init-param>

(/customModes is my wicketFilterPath)

And then, in my WebApplication class:

  @Override
  public Class<? extends Page> getHomePage() {
    return ViewPage.class;
  }

  @Override
  protected void init() {
    mountBookmarkablePage("/view", ViewPage.class);
    mountBookmarkablePage("/edit", EditPage.class);
    mountBookmarkablePage("/help", HelpPage.class);
  }

And it's all working fine now. Whew!

On Mon, Jul 19, 2010 at 12:58 PM, Thijs <vonk.th...@gmail.com> wrote:

> For us this works in the Application class:
>
> /**
>   * @see wicket.Application#getHomePage()
>   */
>  public Class<? extends Page> getHomePage()
>  {
>    PortletRequestContext prc = (PortletRequestContext)
> RequestContext.get();
>    if (PortletMode.EDIT.equals(prc.getPortletRequest().getPortletMode()))
>    {
>      return EditPage.class;
>    }
>    return HomePage.class;
>
>  }
>
>
>
> On 19-7-2010 11:34, Gareth Western wrote:
>
>> Is anyone here using Wicket in a portal (i.e. for portlets)? I'm trying to
>> figure out how to switch pages when the user changes Portlet mode (e.g.
>> VIEW
>> ->  EDIT).
>>
>> Looking through the source, it looks like the responsible method
>> (WicketPortlet#getWicketConfigParameter(PortletRequest request, String
>> paramName, String defaultValue)) doesn't do anything except return the
>> given
>> defaultValue, whereas I was expecting it to try and look up the page for
>> the
>> given paramName...! :(
>>
>> Has anyone got around this problem?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to