You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Cristina <cr...@acm.org> on 2007/12/16 05:44:32 UTC

Two home pages?

Hello,

I'm working on an app where users and admins will perform mutually exclusive
use cases. That's quite a common situation. It looks like the simpler
approach here would be to return one home page with the user menu and
another one with the admin menu. The choice would be placed in the Login
page and executed according to the profile of the username that's trying to
access the app.

At 1st sight, it would demand the inclusion of a method like
getAdminHomePage() in the class implementing WebApplication. So if
getHomePage() returns the user home, getAdminHomePage() would return the
admin home.

Is this approach feasible? Even if it is, would it be a best practice? Are
there better options available?

Thanks so much,

Cristina

-- 
View this message in context: http://www.nabble.com/Two-home-pages--tp14358509p14358509.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Two home pages?

Posted by Maurice Marrink <ma...@gmail.com>.
Or create a single page used by both user as an entry point and have
different menu options visible depending on the user.
Hint: a security framework like swarm can easily do this. :D ;)
http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Security

Maurice

On Dec 16, 2007 5:02 PM, Martijn Dashorst <ma...@gmail.com> wrote:
> Why not:
> Application#getHomePage() {
>     if(!isUser()) { return AdminPage.class; }
>     return UserPage.class;
> }
>
> On Dec 16, 2007 2:46 PM, John Krasnay <jo...@krasnay.ca> wrote:
>
>
> > On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
> > >
> > > Hello,
> > >
> > > I'm working on an app where users and admins will perform mutually
> > exclusive
> > > use cases. That's quite a common situation. It looks like the simpler
> > > approach here would be to return one home page with the user menu and
> > > another one with the admin menu. The choice would be placed in the Login
> > > page and executed according to the profile of the username that's trying
> > to
> > > access the app.
> > >
> >
> > A technique I've used is to have a dummy home page that just redirects
> > to one page or the other:
> >
> > public class HomePage extends WebPage {
> >  public HomePage() {
> >    if (isUser()) {
> >      setResponsePage(UserHomePage.class);
> >    } else {
> >      setResponsePage(AdminHomePage.class);
> >    }
> >  }
> > }
> >
> > You don't even need a HomePage.html file.
> >
> > jk
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-rc1 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Two home pages?

Posted by Martijn Dashorst <ma...@gmail.com>.
Why not:
Application#getHomePage() {
    if(!isUser()) { return AdminPage.class; }
    return UserPage.class;
}

On Dec 16, 2007 2:46 PM, John Krasnay <jo...@krasnay.ca> wrote:

> On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
> >
> > Hello,
> >
> > I'm working on an app where users and admins will perform mutually
> exclusive
> > use cases. That's quite a common situation. It looks like the simpler
> > approach here would be to return one home page with the user menu and
> > another one with the admin menu. The choice would be placed in the Login
> > page and executed according to the profile of the username that's trying
> to
> > access the app.
> >
>
> A technique I've used is to have a dummy home page that just redirects
> to one page or the other:
>
> public class HomePage extends WebPage {
>  public HomePage() {
>    if (isUser()) {
>      setResponsePage(UserHomePage.class);
>    } else {
>      setResponsePage(AdminHomePage.class);
>    }
>  }
> }
>
> You don't even need a HomePage.html file.
>
> jk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-rc1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-rc1/

Re: Two home pages?

Posted by Johan Compagner <jc...@gmail.com>.
do use an exception flow for that thats a bit better.
see

RestartResponseException


On Dec 16, 2007 2:46 PM, John Krasnay <jo...@krasnay.ca> wrote:

> On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
> >
> > Hello,
> >
> > I'm working on an app where users and admins will perform mutually
> exclusive
> > use cases. That's quite a common situation. It looks like the simpler
> > approach here would be to return one home page with the user menu and
> > another one with the admin menu. The choice would be placed in the Login
> > page and executed according to the profile of the username that's trying
> to
> > access the app.
> >
>
> A technique I've used is to have a dummy home page that just redirects
> to one page or the other:
>
> public class HomePage extends WebPage {
>  public HomePage() {
>    if (isUser()) {
>      setResponsePage(UserHomePage.class);
>    } else {
>      setResponsePage(AdminHomePage.class);
>    }
>  }
> }
>
> You don't even need a HomePage.html file.
>
> jk
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Two home pages?

Posted by John Krasnay <jo...@krasnay.ca>.
On Sat, Dec 15, 2007 at 08:44:32PM -0800, Cristina wrote:
> 
> Hello,
> 
> I'm working on an app where users and admins will perform mutually exclusive
> use cases. That's quite a common situation. It looks like the simpler
> approach here would be to return one home page with the user menu and
> another one with the admin menu. The choice would be placed in the Login
> page and executed according to the profile of the username that's trying to
> access the app.
> 

A technique I've used is to have a dummy home page that just redirects
to one page or the other:

public class HomePage extends WebPage {
  public HomePage() {
    if (isUser()) {
      setResponsePage(UserHomePage.class);
    } else {
      setResponsePage(AdminHomePage.class);
    }
  }
}

You don't even need a HomePage.html file.

jk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Two home pages?

Posted by Cristina <cr...@acm.org>.
Hello,

your suggestions are all interesting and valuable... Still, since the menus
in my app already extend Border, I've followed Igor's advice. Now, depending
on the user role, the appropriate menu is shown on the same home page.

I think this is, indeed, the simplest solution when both homes are the same
except for the initial menu. Right now, this is the case regarding my app.
If the home pages get really different at some point in time I'll try the
other options, including Swarm.

Thank you all,

Cristina



igor.vaynberg wrote:
> 
> probably easier to factor out those two pages into panels and have a
> single homepage that shows the right panel.
> 
> -igor
> 
> 

-- 
View this message in context: http://www.nabble.com/Two-home-pages--tp14358509p14368561.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Two home pages?

Posted by Igor Vaynberg <ig...@gmail.com>.
probably easier to factor out those two pages into panels and have a
single homepage that shows the right panel.

-igor


On Dec 15, 2007 8:44 PM, Cristina <cr...@acm.org> wrote:
>
> Hello,
>
> I'm working on an app where users and admins will perform mutually exclusive
> use cases. That's quite a common situation. It looks like the simpler
> approach here would be to return one home page with the user menu and
> another one with the admin menu. The choice would be placed in the Login
> page and executed according to the profile of the username that's trying to
> access the app.
>
> At 1st sight, it would demand the inclusion of a method like
> getAdminHomePage() in the class implementing WebApplication. So if
> getHomePage() returns the user home, getAdminHomePage() would return the
> admin home.
>
> Is this approach feasible? Even if it is, would it be a best practice? Are
> there better options available?
>
> Thanks so much,
>
> Cristina
>
> --
> View this message in context: http://www.nabble.com/Two-home-pages--tp14358509p14358509.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org