|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Component
org.apache.wicket.markup.html.WebComponent
org.apache.wicket.markup.html.include.Include
public class Include
Component that includes/ renders the import result of an URL, much like JSP include.
Use this to integrate non-Wicket locations in your page. This component is NOT meant for integrating more Wicket sources as a means of quick and dirty page composition. Use Panels, Borders and (Markup)inheritance for page composition instead.
You can feed this component the URL directly, or use a model that should deliver a valid URL. You can both use absolute (e.g. http://www.theserverside.com/) and relative (e.g. mydir/mypage.html) urls. This component will try to resolve relative urls to resources in the same webapplication.
The following example shows how to integrate a header and footer, coming from a plain HTML source on the same server is integrated using this component. The files footer.html and header.html would be located in the web application root directory
Java:
... add(new Include("header", "header.html")); add(new Include("footer", "footer.html")); ...Html:
... <div> <div wicket:id="header">header comes here</div> <div>I am the body!</div> <div wicket:id="footer">footer comes here</div> </div> ...
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.Component |
---|
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange |
Field Summary |
---|
Fields inherited from class org.apache.wicket.Component |
---|
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER |
Constructor Summary | |
---|---|
Include(String id)
Construct. |
|
Include(String id,
IModel<String> model)
Construct. |
|
Include(String id,
String modelObject)
Construct. |
Method Summary | |
---|---|
protected String |
importAsString()
Imports the contents of the url of the model object. |
protected boolean |
isAbsolute(String url)
Gets whether the given url is absolute (true) or relative (false). |
protected void |
onComponentTagBody(MarkupStream markupStream,
ComponentTag openTag)
Processes the body. |
Methods inherited from class org.apache.wicket.markup.html.WebComponent |
---|
onRender |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Include(String id)
id
- component idpublic Include(String id, IModel<String> model)
id
- component idmodel
- the modelpublic Include(String id, String modelObject)
id
- component idmodelObject
- the model object (will be wrapped in a model)Method Detail |
---|
protected String importAsString()
protected void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
Component
onComponentTagBody
in class Component
markupStream
- The markup streamopenTag
- The open tag for the bodyComponent.onComponentTagBody(org.apache.wicket.markup.MarkupStream,
org.apache.wicket.markup.ComponentTag)
protected final boolean isAbsolute(String url)
url
- the url
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |