Hi,

You should have a home page for non-authenticated users too.
Once you have a session (authenticated user) requesting '/' will use either
Admin page or User page.


On Mon, Nov 5, 2012 at 7:11 PM, yon10 <[email protected]> wrote:

> I am building an web app using wicket 1.5 in my app i need to diside if the
> user that is currently login is admin or a regular user and display
> diffrent
> html for each of them.
>
> my code id:
> public class HomePage extends WebApplication {
>   private boolean flag = false;
>
>   @Override
>   protected void init(){do things}
>
>   @Override
>   public Session newSession(Request request, Response response) {
>            ... some calculation ...
>      return new HomePageWebSession(request);
>   }
>
>   @Override
>   public Class<? extends WebPage> getHomePage(){
>      if(flag){
>         return Admin.class
>      } else return User.class
>   }
>  }
>
>  the problem is that getHomepage is activated before newSession and i use
> newSession to figure out if the user is Admin or not and init the flag. in
> addition i see that the getHomePage is called multiples times before
> newSession is been called. way getHomePage is called multiples times and
> way
> getHomePage is called before newSession.
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/wicket-create-a-dynamic-return-class-from-getHomePage-tp4653631.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to