问题
Is it possible to create widgets / portlets in GWT that can be dynamically loaded and added to a GWT web application, and where the GWT widgets can reside in a separate war files?
To clarify my question: JSR168/JSR286 compliant portals make it possible to create portlets in separate projects (war files) and to dynamically load these into a portal page. Suppose you want to do something similar in a GWT application. So suppose we made a portal using only GWT for the GUI (no JSP or alike) and we want to dynamically add a "portlet" written in pure GWT. Would that be possible?
I can imagine that it could be done using an IFrame, but it would be nicer if such a GWT widget/portlet would be fully part of the GWT host "portal" application and share it's style sheets and other resources.
回答1:
I'd imagine that a "GWT portlet" is nothing more than a widget that you write yourself (and perhaps implements a common interface).
The hard part is to dynamically allow a precompiled gwt app to include another gwt component (the portlet in this case) without compiling again with the source (which is what the question seems to imply).
回答2:
I too have been looking into this, especially after seeing the Wave demo. From what I can tell, the approach the wave team have taken is to use either the Google Gadget api or a variation of the Gadget api. Google also have a tutorial on writing a gadget in GWT. I would image you would use a event based api where JSO objects are passed between the Gadget and the GWT application. Note that this may also introduce XSS issues if from different domains. I think of this as akin toloading a swf dynamically in flash. The event method is similar to working safely with cross-site dynamic loaded swf's.
回答3:
I'm very new in GWT yet, but based in what i'd readed I can tell you that you must follow an architecture MVP with an App Controller that "plug" and "play" dynamically what you want to dispatch using metadata that must come from the model layer... Something like a "meta-application"
来源:https://stackoverflow.com/questions/814647/is-it-possible-to-create-dynamically-pluggable-gwt-widgets-portlets-in-separate