Problem with multiple entry Points in the same mod

2019-01-23 17:43发布

I have multiple entry points in the same module.

For example I have an Home entry point for the home page and an Admin entry point for the admin page.

<entry-point class='com.company.project.client.HomeModule'/> 
<entry-point class='com.company.project.client.AdminModule'/> 

The way I am setup now - I need to check somt like this in my OnModuleLoad:

if((RootPanel.get("someHomeWidget")!=null)&& 
  (RootPanel.get("someOtherHomeWidget")!=null)) 
{ 
  // do the stuff 
} 

in order the the Admin Entrypoint not to be executed when the Home page gets open and the other way around.

Not doing the check above also involves that if I have a div with the same name in both the Home and Admin page whatever I am injecting in it shows up twice on each of them.

This stinks 1000 miles away and is obviously wrong: what's the correct way to do this in people experience?

Any help appreciated!

7条回答
混吃等死
2楼-- · 2019-01-23 18:29

Dont consider Admin and home page as different pages. Concept of pages is not applicable to GWT, as there is only one single page, ie single entrypoint. If you want to give effect of different pages, then use URL rewriting features of GWT.

If you do want to use different Entrypoints, then as said in above comment, use different modules.

查看更多
登录 后发表回答