Multiple GWT β€œPages” with Human-Friendly URLs

I play with the GWT / GAE project, which will have three different "pages", although in reality these are not pages in the sense of GWT. The top views (one for each page) will have completely different layouts, but some of the widgets will be shared.

One of the pages is the main page, loaded by default url ( http://www.site.com ), but the other two require additional URLs to distinguish the type of page. They also need a name parameter (for example, http://www.site.com/project/project-name . There are at least two solutions that I know of.

  • Use the GWT history engine, and let the page type and parameters (such as the project name) be part of the history token.
  • Use servlets with URL patterns (e.g. / project / *)

The first choice may seem obvious at first, but it has several drawbacks. First, the user should be able to easily remember and enter the URL directly into the project. It's hard to create a human friendly url with historical tokens. Secondly, I use gwt-presenter, and this approach means that we need to support subheadings in one token, which I would prefer to avoid. Thirdly, the user will usually remain on one page, so it makes sense that the page information is part of the "static" URL.

Using servlets solves all these problems, but also creates others.

So my first questions are: what is the best solution here?

If I went for a servlet solution, new questions would appear.

  • It might make sense to split the GWT application into three separate modules, each with an entry point. Each servlet that maps to a specific page then simply redirects the request to the GWT module that processes this page. Since the user usually stays on one page, the browser only needs to download js for this page. Based on what I read, this solution is not recommended.

I could also stick with one module, but then GWT needs to figure out which page it should display. It can either query the server or parse the URL itself.

  1. GWT, , . , , , . , . ?

GWT + . , GWT , ? , . .

- , ?: -)

+3
2

. . , " URL- " - :) URL-, , , - -, , , .

-, gwt-presenter , , .

gwt-presenter (, :)), , MVP - ( gwt-presenter) , . , gwt- "" / - , , , , ( ).

- ​​, - (/apps, "" /) - , , , . , (, ).

+3

, , , - : JSP, JSF, Wicket, PHP . GWT - , . GWT webapp . , ; gwt-presenter - , . GWT , - ( , ).

, , GWT @StackOverflow:) " GWT?" : " ".

Wicket, App Engine , . : http://stronglytypedblog.blogspot.com/2009/04/wicket-on-google-app-engine.html

-2

Source: https://habr.com/ru/post/1735930/


All Articles